PIC16F877A Assembly Code for 633???


New member
Does anyone have any PIC assembly code for controlling the 633. My generic Rs232 code is just not cutting the mustard. Here it is.

;Set up serial port.

SetupSerial: Bank1 ;select bank 1
movlw 0xc0 ;set tris bits for TX and RX
iorwf TRISC,F
movlw SPBRG_VAL ;set baud rate
movwf SPBRG
movlw 0x65 ;enable nine bit tx and high baud rate
movwf TXSTA
Bank0 ;select bank 0
movlw 0xd0 ;enable serial port and nine bit rx
movwf RCSTA
clrf Flags ;clear all flags

then i send my text, which works when connected to hyperterminal:

TransmitSerialma: Bank0 ;select bank 0
btfss PIR1,TXIF ;check if transmitter busy
goto $-1 ;wait until transmitter is not busy
movlw 0x56 ; data movwf TXREG ;transmit the data

I looked at the DATA SHEETs command codes, and read how the PACKETS are sent. <type><valid data length 0-16><data><crc>. I want to just clear the LCD. Your code is:
type = 6
valid data_length is 0
The return packet will be:
type = 0x40 | 6
data_length = 0

How do I send this command in Assembly language?
movlw 0x????????????? ;data

Any help would be aprreciated

Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.

CF Tech

I can give you an example packet with a pre-calculated CRC, and you can send bytes corresponding to that packet from the PIC.

But, in general, you will need to be able to calculate the CRC. We have some example C code (in 633_WinTest).

Please check on PICLIST for a general purpose assembly CRC-16 routine, I imagine there is already one coded for the PIC.


New member
633 CRC Assembly Code

First, thanks for replying :).

I thought the CRC was part of the whole packet. I'm kind of confused on what the CRC is. Is it a bit check packet?

Can you send me that example CRC packet in Assembly language? All I can get so far is the power up screen. I think I will actually pay you 5 bucks if you can send me some assembly code that will output something on my 633 besides this. I have looked and looked at your C++ source code, and am having trouble deciphering it, let alone converting the code I need to Assembly. I'm not that great at C++ and finding exactly where the lines are and commands are for outputting to the LCD in the code has been time consuming and futile. I will check PICLIST again for some more info.

USB LCD Displays - Graphic and Character LCDs with a Keypad


New member
Got it to work :)


Thanks for the feedback and helping me with the CRC check. Finally sent something to the screen!!!!!!! Yeah Yeah.