Vm111 Sample c code for 16f873

As a novice, I have had some difficulty getting the hex output from the CCS compiler into a 16f873 - my coding start ppoint is project in CCS c IDE that I have found on the web that is a close match to my target application . Although I have I now got the device accpting hex machine code - the overall complexity of the code is relatively high (for me) the code drives a 16x2 lcd module based on an incoming pulse train.

Before I hook up all the hadware I wanted to make sure, I have a viable development and device programing setup - to that end I tried a series of simplicications ultimately ending up with what looks the most basic code that I could think of:

I have left all other code in place and inserted the following in the main


void main ()

integer testflag;

while (testflag != 3)
{
delayms (1000);
if (testflag = 1)
{
output_high (VM111_RA2_LED);
testflag = 0;
else
{
output_low (VM111_RA2_LED);
testflag = 1;
}
}

… all other code left in


VM111_RA2_LED is a constant defiened to point to PIN_A2 and the code also includes 16f873.h as well as another module to drive the lcd.

I was hoping to see the LED hanging off RA2 blinking once per sec… but nothing

The fundamental question is how do I daignose from here:

How can I debug where the program counter is with ICE

The hex code was generated using the CCS IDE, I had to frig this to load using progpic2 see (viewtopic.php?f=4&t=737) , what I did notice is when I used picprog2 to read the contents of the device compared to the hex compiler output the byte order was reversed. I thought this may have just been file storage convention - but I wonder if the pic is not executing the code I think it is.

Does anyone have a simple project in CCS that I can use to verify my instalation.

Any other suggestions?

Thanks in advance

Roy Duggan