Shop OBEX P1 Docs P2 Docs Learn Events
Serin/serout conflict of bs2 — Parallax Forums

Serin/serout conflict of bs2

Amser99Amser99 Posts: 2
edited 2004-08-20 15:06 in BASIC Stamp
Hi everybody,
It's me again, sorry to keep asking questions, but I'm still stuck with my voice-activated clock design.
I would like to ask a question about SERIN/SEROUT problem confused.gif
My BS2+DS1302 is connected to the Voice chip, and when I ask the time, the BS2+DS1302 will send time data to the Voice chip so that it will speak out the time, and when I say "Set time", it will work the other way around, i.e. the Voice chip will send time data back to the BS2+DS1302 so that the time will be reset on the clock.
However, when SERIN and SEROUT are both used in my BS2 program, the program only chooses SEROUT To implement, so I was thinking of putting a "testing input" to the BS2 so that the BS2 can select whether to use SERIN or SEROUT (when·Test input is HEX 01)·as following:

INPUT Test
IF (Test = $01) THEN Loop
ELSE
GOTO Loop0
ENDIF

Loop0:
SERIN 4, 84, 2000, No_Data, [noparse][[/noparse]Hours.HIGHNIB, Hours.LOWNIB, Minutes.HIGHNIB, Minutes.LOWNIB]
Temp = Hours
RTCCmd = HrsReg
GOSUB WriteRTC
Temp = Minutes
RTCCmd = MinReg
GOSUB WriteRTC
Temp = $80
RTCCmd = CtrlReg
GOSUB WriteRTC
·DEBUG CLS,· DEC Hours.HIGHNIB, DEC Hours.LOWNIB, DEC Minutes.HIGHNIB, DEC Minutes.LOWNIB
GOTO Loop0
No_Data:
'DEBUG CLS, "Timed out"
GOTO Loop0

Loop:
SEROUT 3,84, [noparse][[/noparse]HEX1 Hours.HIGHNIB, HEX1 Hours.LOWNIB, HEX1 Minutes.HIGHNIB, HEX1 Minutes.LOWNIB] ' HEX Seconds.HIGHNIB, HEX Seconds.LOWNIB
GOSUB ReadRTCBurst
GOTO Loop

The Test input value· (0x01) is sent from my Voice chip into the BS2 when I request the BS2 to do the Serout. So could anyone please shed any light on this problem? I would really appreciate your help!!jumpin.gifroll.giftongue.gifroll.gif

Comments

  • K de JongK de Jong Posts: 154
    edited 2004-08-19 21:32
    Hi,

    You say that your program allways chooses SEROUT, does that mean that the clock only talks to you and does'nt listen?

    If so, the problem could be in your software, or in your speech recognition system or somewhere in between. Are you sure the problem is in your program?

    Could you please explane these things a little further, ie what happened after you inserted the 'loop' stament could be of interest.

    Regards,

    Klaus
  • Amser99Amser99 Posts: 2
    edited 2004-08-20 14:39
    Hi,

    The clock does listen to me (i.e., allowing time data transferred in) when only Loop0 (SERIN) presents in the program (i.e, if I send·1,2,3,4·from the voice chip to the BS2, on the DEBUG screen, it will appear "1234"). However, if I also include Loop (SEROUT part) into the program, the clock only works in the time answering part (i.e., it will speak out the time), and on the DEBUG screen, nothing is displayed, which, in my opinion·means Loop0 (SERIN) does not work. Therefore, I try to include another input "Test" (as Pin 5 of the BS2, and I define it in the program as "Test CON 5"), acting like a switch, to choose when to use the Loop, when to use the Loop0, in form of "If...then" condition statement. But still, it does not work, always execute the Loop only. I know my problem sounds complex, maybe I don't know how to explain it clearly.·I hope·someone·can figure out and help me. Thanks a lot!

    P/S: If you need to see the whole program, I can post it up, I'm just afraid it's too much for a post here.cry.gif
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2004-08-20 15:06
    Amser99 -

    I may be wrong, but I think LOOP is a keyword or PBASIC Operative. You may want to add another character to it like LOOP1 to make it look more like a label, and less like a keyword.

    Bruce Bates
Sign In or Register to comment.