Follow Me On...

CCS Compiler Guide

How to print debug messages:

The ICD can be used to relay messages to the computer which can be very helpful in debugging. In order to do this all you have to do is:

 #use rs232(DEBUGGER) // sets the active rs232 object to use the ICD settings for i/o pins and baud rate
printf("Here is the message to be displayed!");

Then you can view the messages on the monitor tab in the debugger pane.


Using an Parallel LCD on port B

The Alphanumeric LCD library which is included with the compiler expects that you will hookup an LCD on port B which shares the ICSP pins B6 and B7.

// B1 = enable 
// B2 = w/r     // read/write select
// B3 = csbar  // command or data mode, also used for LV-ICSP
// B4 = D4     // data bit
// B5 = D5    // data bit
// B6 = D6    // data bit, also used for ICSP: PGC
// B7 = D7   // data bit, also used for ICSP: PGD

When i tried hooking up the LCD suddenly the debugger was unable to recognize the target chip and the PIC locked up.  I found the following post on the ccs forums to solve the problem.

"I use RB4-7 to drive LCDs all the time, and use ICSP whenever possible.

At first I had all sorts of problems programming the PIC when the LCD was connected. After a bit off thought I realised that the problem was the LCD WR pin floating high , thus going into READ mode and corrupting the data on RB6 and RB7.

If you are controlling the LCD_RW line with one the PIC pins, tie it low with a resistor to keep it in write mode and the lcd data lines will be in high impedance and not bother you at all."

Hook the LCD_RW Pin -> resitor -> gnd  and nothing connects to that corresponding LCD Pin