Help with code
maad
Posts: 28
This code sends a continuous instruction to the printer driver as long as pin 0 is high, I cannot make it stop printing unless I depress button 0. What I'm trying to do is to print only one time no matter button 0 is pressed and not forever as it doing it right now.
'
[ Main Routine ]
Reset:
DO
GOSUB Print_String
SERIN 16, SerInBaud, 250, Reset, [WAIT("!!!"), command]
IF command = "A" THEN
writePntr = 0
WRITE writePntr, STX
writePntr = writePntr + 1
DO
SERIN 16, SerInBaud, [char] ' send stuff to printer
IF char = 10 THEN
EXIT
ELSE
WRITE writePntr, char
writePntr = writePntr + 1
ENDIF
LOOP
WRITE writePntr, ETX
ELSEIF command = "B" THEN
ENDIF
LOOP
'
[ Subroutines ]
No_Inkjet:
' handle no response from Inkjet here
GOTO Reset
Print_String:
msgPntr = 0
DO
IF IN0 = 1 THEN
READ msgPntr, char ' get character from msg
SEROUT Inkjet, Baud, [char] ' send to print driver
msgPntr = msgPntr + 1 ' point to next char
ENDIF
LOOP UNTIL (char = ETX)
SEROUT Inkjet, Baud, [Esc, "C", 15] ' intercolumn delay 1.5 ms
SERIN Inkjet, Baud, 500, No_Inkjet, [WAIT(Prompt)]
PAUSE 100 'delay betwe
RETURN
'
[ Main Routine ]
Reset:
DO
GOSUB Print_String
SERIN 16, SerInBaud, 250, Reset, [WAIT("!!!"), command]
IF command = "A" THEN
writePntr = 0
WRITE writePntr, STX
writePntr = writePntr + 1
DO
SERIN 16, SerInBaud, [char] ' send stuff to printer
IF char = 10 THEN
EXIT
ELSE
WRITE writePntr, char
writePntr = writePntr + 1
ENDIF
LOOP
WRITE writePntr, ETX
ELSEIF command = "B" THEN
ENDIF
LOOP
'
[ Subroutines ]
No_Inkjet:
' handle no response from Inkjet here
GOTO Reset
Print_String:
msgPntr = 0
DO
IF IN0 = 1 THEN
READ msgPntr, char ' get character from msg
SEROUT Inkjet, Baud, [char] ' send to print driver
msgPntr = msgPntr + 1 ' point to next char
ENDIF
LOOP UNTIL (char = ETX)
SEROUT Inkjet, Baud, [Esc, "C", 15] ' intercolumn delay 1.5 ms
SERIN Inkjet, Baud, 500, No_Inkjet, [WAIT(Prompt)]
PAUSE 100 'delay betwe
RETURN
Comments
That's your advice?, go to your room!!
Forum Guidelines
Provide a clear, specific and concise subject line:
This is one of the most important details to obtaining a reply to your question. In order to engage somebody on the forum it is to your benefit to provide a clear subject line detailing the nature of your question. Be as concise as possible.
That's all you're getting out of me till you get with the program.