Shop OBEX P1 Docs P2 Docs Learn Events
Help with code — Parallax Forums

Help with code

maadmaad Posts: 28
edited 2011-04-13 05:41 in BASIC Stamp
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

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-04-12 14:18
    This is the second thread you've started with the title "Help with code".
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-04-12 15:15
    attachment.php?attachmentid=78421&d=1297987572
  • maadmaad Posts: 28
    edited 2011-04-12 23:59
    PJ Allen wrote: »
    This is the second thread you've started with the title "Help with code".

    That's your advice?, go to your room!!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-04-13 05:41
    Forum Guidelines

    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.
Sign In or Register to comment.