PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 23, 2007 12:32 pm |
|
|
Look at the demo program below. It displays the following output
when I compile it with vs. 4.032 and run it in the MPLAB simulator with
output going to 'UART1', which is then displayed in the Output window:
Quote: |
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
|
Code: |
#include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
char const weekday_names[7][10] =
{
{"Sunday"},
{"Monday"},
{"Tuesday"},
{"Wednesday"},
{"Thursday"},
{"Friday"},
{"Saturday"}
};
//================================
void main()
{
char ram_array[10];
int8 i;
for(i=0; i < 7; i++)
{
strcpy(ram_array, weekday_names[i]);
printf("%s\r", ram_array);
}
while(1);
} |
|
|