Hello.
I am coding to build-up SDLC(HDLC) in z85c30 with MCU, ATmega128.
I am trying to build-up SDLC(HDLC) protocal H/w environment is z85c30(CMOS) with 4.91520Mhz crystal for PCLK. Also, z85c30's D0~D7 is connected with MCU in un-multiplexe mode(=direct)
communication specification is as below - 38.4kbps - NRZI mode - Response time: 50ms - Address: Lower=70h Higher=05h - control field: 13h - Information field if first text = 20, SDR(Master -> Slave) if first text = 30, SD(Slave -> Master)
For SDR, Information field length is 20 + 7bytes (8bytes) For SD, Information field length is 30 + 11bytes (12bytes)
with this specification, I do code as below. For Rx, I use interrupt drived method, and for Tx just polling method used.
Now, this code works on only Rx. Tx does not work, which means master could not get data. I can receive data, but can not send(Tx) to master device.
Could you please check this procedure in c lang with any advice? I hope I may get some helpful hands from your side.
---------code in c lang: Mai function------------------------------------- void main(void){ __disable_interrupt(); //All interrupt disable
SETBIT(INTACK); //NO interrupt ack. z85c30_set(); //sub-function will be shown below z85c_enable(); //sub-function will be shown below
__enable_interrupt(); //All interrupt enable
while(1){ switch(sdlcstep){ case 0: //Rx start Write_reg(5,0x60); //Tx 8bits, Tx disable Write_reg(3,0xcc); //Rx 8bits, Rx CRC enable, Addres
search mode Write_reg(3,0xcd); //Rx enable Write_Reg(1,0x10); //Rx int on all received characte
or special condition break; case 1: //If Rx Ok. if(RxOk){ for(icnt=4;icnt