| ??? 06/16/03 06:25 Read: times |
#48458 - RE: Printer interface with 8051 uC Responding to: ???'s previous message |
Erik ??? Or Tayyaba ?? OK its the later who got your problem. Here we go with ALL the code required for printing : P1.3 is the Strobe pin, P1.4 is the Busy pin and the processor an 8052 @12Mhz. This is a memory mapped setup - modify based on your setup. Call PRNOUT with ACC loaded with the character ( ASCII please ) to be printed. Thats all. PRNOUT: MOV P2,#ADDR_HI ; Send 1 character to printer MOV R0,#PRN MOVX @R0,A CLR P1.3 ; Strobe pulse start... MOV R4,#50 PRN_DLY:DJNZ R4,PRN_DLY SETB P1.3 ; Strobe pulse end.. WAIT: JB P1.4,WAIT ; Printer Busy. Wait. RET Disclaimer : This is the basic code. This cannot handle Printer error states , paper out and stuff like that. OK the road has been shown - now you walk. Raghu |



