The serial communication with my self-made 8031 board works in assembler (beneath) but it does not work properly with C code doing the same. Anyone to know what the problem may be? Thanks NAME SAMPLE DS 10H CSEG AT 0A100h START: MOV SP,#50 ; Oscillator frequency = 11.059 MHz MOV TMOD,#00100000B ;C/T = 0, Mode = 2 MOV TH1,#0FDH SETB TR1 MOV SCON,#01010010B MOV A, #"a" REPEAT: JNB TI,$ CLR TI MOV SBUF,A SJMP REPEAT END
"does not work properly with C code doing the same. Anyone to know what the problem may be?" Obviously, the 'C' code is not quite doing the same! Without seeing your 'C' code, how can anyone comment further? Please read the instructions (3 bullet points immediately above the 'Message' box) before posting code. Have you tried the simple "Hello, World" 'C' example shipped with the compiler? Have you tried it in the simulator?
#pragma iv(0xA000) #include "reg51.h" #include <stdio.h> void main (void){ TMOD = 0x20; TH1 = 0xFD; TR1 = 1; SCON = 0x52; //printf("a"); }