![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| PIC Programing / Design Discuss programing of PIC chips here and design of electronics using PIC chips. |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hi All. I am relatively new in the world of programming MCUs. I tried to set up a communication between my Pic and Vertual Terminal in Proteus. I wrote the following code in MikroC. But it isnt working. The Vertual terminal displays 00 00 00 00 00 etc. Please tell what to do. Here is the code. unsigned char txt[8]; unsigned int i; void main() { Usart_Init(9600); Lcd_Init(&PORTD); txt[0]="12"; txt[1]="20"; txt[2]="50"; txt[3]="10"; txt[4]="40"; txt[5]="80"; txt[6]="76"; txt[7]="48"; for (i=0;i<8;i++) Usart_Write(txt[i]); } |
|
#2
| |||
| |||
| I'm surprised it even compiled.. the arra of chars you have is a character array, not an array of strings, which, by your code example, is what you are thinking it is. try txt[0]='a'; instead of "a" or "12". The single quotes say use on echaracter, the double quotes says use a null terminated string. so "12" = '1','2', and '\0'.. in memory. while 'a' is just the single character 'a'. If you want the string "hello" to show up, use txt[0]='h'; txt[1]='e'; txt[2]='l' txt[3]='l' txt[4]='o' txt[5]='\0'; // this is a zero, not a capital O Good luck. Horsedorf |
|
#3
| |||
| |||
| Also, don't forget to use (USART_Data_Ready()) before sending text.. like this.. for(i=0;i<8 && tx[i] != (unsigned char)0 ;i++){ // For the contents of the array up to // a nul element. // or the max size of the array. while(!USART_Data_Ready()); // wait for the data set ready line so we don't overrun the uart. USART_Write(tx[i]); // then write the character. } |
|
#4
| |||
| |||
| I have made the pcb router board from the following site. http://www.cq.cx/pcb-router.pl My problem is i have converted the asm file to hex and loaded it to the PIC 16f877a but i can not compile the software. Can anyone help me compile the software on the site or show me what software is available for this PIC. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using PIC 16F877A to program pneumatics | Syphonics | PIC Programing / Design | 3 | 12-22-2006 11:25 AM |