This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

N2het Serial Port TX

Other Parts Discussed in Thread: LM10

Hi,

I found code for N2Het serial communicationin here. when ı look at the code,  I think that reduce this code.but I am not sure. so I want to ask to you.

it is original :(in forum)

SCITX                CNT     { next= Lm10,  reg = T, max= 12, irq = OFF,data=0}
Lm10                 BR      { next= SCIRX, cond_addr= Lm11, event = ZERO}
Lm11                 DJZ { next=SendOverINT,cond_addr=SCIRX,reg=A,irq=OFF,data=0}; set to number of bit to transfer
SendOverINT   CNT { reg=A,irq=ON,max=9,data=0};
Lm12                 SHFT { next=SCIRX,smode=OR0,prv=OFF,cond_addr=SCIRX,cond=UNC,pin=TX1_PIN,reg=A,irq=OFF,data=0x0};

 

Can I do one instructions for sent data, using SHFT instructions.

SCITX                CNT     { next= Lm10,  reg = T, max= 12, irq = OFF,data=0}
Lm10                 BR      { next= SCIRX, cond_addr= Lm11, event = ZERO}

Lm12                 SHFT { next=SCIRX,smode=OR1,prv=OFF,cond_addr=SCIRX,cond=UNC,pin=TX1_PIN,reg=A,irq=On,data=0x0};

Firstly : Shft irq = open

Secondly smode = OR1

My data format (1 bit stop  +  8 bit data  + 1 bit start)

can I do as this ?

 

  • How do you know the data buffer is empty (ready to transfer the next data)?

    Regards,

    Haixiao

  • 1- I think that when program start, Smode will be  OR1

    2- I want to sent a data I change Smode and will be OR0 and after ı sent to data , Het generate interrupt. and immediately, I change smode  and again OR1. 

    I did that  but It  was  not work because of Shift İnstruction. Shift instruction firstly control and then shift and so shift instruction send extra bit (0) and receiver suppose that start bit. İf shift instructer firstly execute and after that make a control (if all bit 0, generate interrupt), it worked..