Description: I am trying to use a PIC 16F877A Microcontroller to write text lines to my CFA 635 serially. I am using the CCS PCWH compiler for the PIC and have tried several configuration. The problem is not in my programming, it is the communication link between my PIC serial and the LCD. Here is the work I have done.
/////////////////////////////////////////////////
//Setup Information
/////////////////////////////////////////////////
//CFA 635
//RS232 for communications
//Baud @19200
//PIC 16F877A
//Compiler CCS PCWH
//Crystal 20MHz
/////////////////////////////////////////////////
//Scenerio 1 - using
//635_WinTest_1_0
/////////////////////////////////////////////////
I communicate VIA RS232 Com1 of the Pc through this software no problems everything works great. I changed my setting to use the baud 19200 and ran the packet debugger to store settings as default in EEPROM. Now my baud is set.
/////////////////////////////////////////////////
//Scenerio 2 - PIC to Windows
//Terminal VIA RS232 COM1 19200
/////////////////////////////////////////////////
I have programed my pic to perform the correct operations described in the data sheet. Program works beautifully. Auto sets up the string format and calcs the CRC, and sends packet correctly. I verified with the packet debugger. An example is the following string. I type "Hello there" the following hex code from PIC to terminal is "1f 0d 00 00 48 65 6c 6c 6f 20 74 68 65 72 65 43 c1" thats
TYPE = 0x1f (31)
Length = oxod (13) 2loc 11text
DATA----
Loc = 0x00 0x00
data is just hex text
CRC = 0x43 0xc1
Another example string from my PIC is the following.
I want to send
LINE 0:"Hello there"
LINE 1:"This is your"
LINE 2:"computer speaking"
LINE 3:"to you VIA PIC16f877"
HEX ON TERMINAL
LINE 0:"1F 0D 00 00 48 65 6C 6C 6F 20 74 68 65 72 65 43 C1"
LINE 1:"1F 0E 00 01 54 68 69 73 20 69 73 20 79 6F 75 72 9C 92"
LINE 2:"1F 13 00 02 63 6F 6D 70 75 74 65 72 20 73 70 65 61 6B 69 6E 67 8F DE"
LINE 3"1F 16 00 03 74 6F 20 79 6F 75 20 56 49 41 20 50 49 43 31 36 66 38 37 37 98 43"
Appears to be working perfectly, using the "C" bit shift implementation.
/////////////////////////////////////////////////
//Scenerio 3 - Trying to send directly
//from PIC to LCD
/////////////////////////////////////////////////
Since all data streams are correct, I should be able to connect PIC->RS232 Line converter->Line Converter on LCD-->LCD SCREEN.
with this setup I have tried both strait through and Null modem connection (EG switching RX TX). using your cables. I spoke with you guys on the phone, and tried removing line converters on both sides and doing TTL level communication rx tx and tx rx. LCD still doesn't repond!
I though maybee I wasn't streaming the packets smothly so I used a basic RS232 program and manually send the packets so there was no delay. Still no luck.
I can plug the LCD into the PC and it works fine with your cable, what is wrong? Are there more connection than TX RX +5 GND? Is their RS232 Handshaking eg CLS DTS?
ONE thing, i can parallel the connection to the PC and LCD, so i can see on my terminal what is writing and should be sent to LCD. My TTL level cabling is using your header1 "H1" pins F4P to PIC TX, F4T to PIC RX, +5 to +5, GND to GND. When I Let pin F4p go to TX my console stopps responding like its hanging my data? maybee wrong line or shorting levels? Please Help, and sorry this post is so long. Thanks for any advice you can give.
-MIKE->
/////////////////////////////////////////////////
//Setup Information
/////////////////////////////////////////////////
//CFA 635
//RS232 for communications
//Baud @19200
//PIC 16F877A
//Compiler CCS PCWH
//Crystal 20MHz
/////////////////////////////////////////////////
//Scenerio 1 - using
//635_WinTest_1_0
/////////////////////////////////////////////////
I communicate VIA RS232 Com1 of the Pc through this software no problems everything works great. I changed my setting to use the baud 19200 and ran the packet debugger to store settings as default in EEPROM. Now my baud is set.
/////////////////////////////////////////////////
//Scenerio 2 - PIC to Windows
//Terminal VIA RS232 COM1 19200
/////////////////////////////////////////////////
I have programed my pic to perform the correct operations described in the data sheet. Program works beautifully. Auto sets up the string format and calcs the CRC, and sends packet correctly. I verified with the packet debugger. An example is the following string. I type "Hello there" the following hex code from PIC to terminal is "1f 0d 00 00 48 65 6c 6c 6f 20 74 68 65 72 65 43 c1" thats
TYPE = 0x1f (31)
Length = oxod (13) 2loc 11text
DATA----
Loc = 0x00 0x00
data is just hex text
CRC = 0x43 0xc1
Another example string from my PIC is the following.
I want to send
LINE 0:"Hello there"
LINE 1:"This is your"
LINE 2:"computer speaking"
LINE 3:"to you VIA PIC16f877"
HEX ON TERMINAL
LINE 0:"1F 0D 00 00 48 65 6C 6C 6F 20 74 68 65 72 65 43 C1"
LINE 1:"1F 0E 00 01 54 68 69 73 20 69 73 20 79 6F 75 72 9C 92"
LINE 2:"1F 13 00 02 63 6F 6D 70 75 74 65 72 20 73 70 65 61 6B 69 6E 67 8F DE"
LINE 3"1F 16 00 03 74 6F 20 79 6F 75 20 56 49 41 20 50 49 43 31 36 66 38 37 37 98 43"
Appears to be working perfectly, using the "C" bit shift implementation.
/////////////////////////////////////////////////
//Scenerio 3 - Trying to send directly
//from PIC to LCD
/////////////////////////////////////////////////
Since all data streams are correct, I should be able to connect PIC->RS232 Line converter->Line Converter on LCD-->LCD SCREEN.
with this setup I have tried both strait through and Null modem connection (EG switching RX TX). using your cables. I spoke with you guys on the phone, and tried removing line converters on both sides and doing TTL level communication rx tx and tx rx. LCD still doesn't repond!
I though maybee I wasn't streaming the packets smothly so I used a basic RS232 program and manually send the packets so there was no delay. Still no luck.
I can plug the LCD into the PC and it works fine with your cable, what is wrong? Are there more connection than TX RX +5 GND? Is their RS232 Handshaking eg CLS DTS?
ONE thing, i can parallel the connection to the PC and LCD, so i can see on my terminal what is writing and should be sent to LCD. My TTL level cabling is using your header1 "H1" pins F4P to PIC TX, F4T to PIC RX, +5 to +5, GND to GND. When I Let pin F4p go to TX my console stopps responding like its hanging my data? maybee wrong line or shorting levels? Please Help, and sorry this post is so long. Thanks for any advice you can give.
-MIKE->
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.