Hi all, I have written a program in VC++ to write a char array of 13 bytes on COM port using 9600-N-8-1 parameters. when i send this to my target device it responds, but same program when i send through 89S51 my device does not respond.To set 9600-N-8-1 i have written 0xFD value. Can anyone no the reason for such strange behaviour. Please let me know.... rutu.
#include<reg52.h> #include<stdio.h> char m_Write[13]={0x40,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,0xBF,0x0A}; char loop=13; void main(void) { SCON=0x50; TMOD |=0x20; TH1=0xFD; TR1=1; TI=1; while(1) { while(loop--) putchar(m_Write[13-loop]); loop=13; } }
#include<reg52.h> #include<stdio.h> static unsigned char m_Write[13] = {0x40,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x79,0xBF,0x0A}; void main(void) { unsigned char loop; SCON=0x50; TMOD |=0x20; TH1=0xFD; TR1=1; TI=1; while(1) { for (loop = 13; loop; loop--) { putchar(m_Write[13-loop]); } } }
I guess ur COM device uses stream CTRL.
Whatis this stream CTRL ? can you please clearify it or give me the links where i can find more info.