Stuck!
Archiver
Posts: 46,084
I need a way of sending text commands to an RS232 device (a dimmer
controller)based on certain conditions of a DVD player which
provides me with frame information. All the interfacing is worked
out but what I need is a way of storing the string commands in
variables. That will minimize the code I have to write. But as you
know I can only store one asci letter in a byte. I would love to be
able to put all my string commands in a list and then do lookup of
the item that I want based on the info I receive from the DVD and
then send that item to the dimmer.
If the above is vague I can explain further...
Al Najjar
controller)based on certain conditions of a DVD player which
provides me with frame information. All the interfacing is worked
out but what I need is a way of storing the string commands in
variables. That will minimize the code I have to write. But as you
know I can only store one asci letter in a byte. I would love to be
able to put all my string commands in a list and then do lookup of
the item that I want based on the info I receive from the DVD and
then send that item to the dimmer.
If the above is vague I can explain further...
Al Najjar
Comments
STFR=10 'start frame
DVD:
serout DVDTX,BAUD,1,[noparse][[/noparse]"FR",dec STFR,"SE",cr]
serin DVDRX,BAUD,6000,UHOH2,[noparse][[/noparse]wait("R")]
serout DVDTX,BAUD,1,[noparse][[/noparse]"PL",cr]
serin DVDRX,BAUD,6000,UHOH2,[noparse][[/noparse]wait("R")]
pause 3000
ENDFR=1000 'end frame
chk1: 'plays to frame 1000 then does something
TKO=0 ' set timeout lockup counter back to 0
serout DVDTX,BAUD,1,[noparse][[/noparse]"?F",cr]
serin DVDRX,BAUD,6000,UHOH3,[noparse][[/noparse]dec CURFR,wait(cr)]
'DEBUG "CURRENT FRAME = ", dec CURFR, CR
if CURFR=>ENDFR then DIM1
goto chk1
DIM1:
serout dimtx, baud2,1,[noparse][[/noparse]"WHATEVER1",CR]
serin dimrx, baud2, 6000, UHOH4,[noparse][[/noparse]wait("R")]
ENDFR=2000
chk2:
TKO=0 ' set timeout lockup counter back to 0
serout DVDTX,BAUD,[noparse][[/noparse]"?F",cr]
serin DVDRX,BAUD,6000,UHOH3,[noparse][[/noparse]dec CURFR,wait(cr)]
'DEBUG "CURRENT FRAME = ", dec CURFR, CR
if CURFR=>ENDFR then DIM2
goto chk1
DIM2:
serout dimtx, baud2,[noparse][[/noparse]"WHATEVER2",CR]
serin dimrx, baud2, 6000, UHOH4,[noparse][[/noparse]wait("R")]
.
.
.
etc.
I could probably help you with some stamp code to control the pioneer
DVD-V7400 if you like.
-Marie
need:
Msg1 DATA "This is message 1", 0 ' zero-terminated strings
Msg2 DATA "This is message 2", 0
Main:
' some code -- determine which message to send; put value in msgNum
LOOKUP msgNum, [noparse][[/noparse]Msg1, Msg2], eeAddr ' get pointer to string
GOSUB Send_String
' clean-up code after sending message
GOTO Main
Send_String:
READ eeAddr, char
IF (char = 0) THEN Send_String_Exit
SEROUT sPin, sBaud, [noparse][[/noparse]char]
eeAddr = eeAddr + 1
GOTO Send_String
Send_String_Exit:
RETURN
Send_String_25: ' for PBASIC 2.5
DO
READ eeAddr, char
IF (char = 0) THEN EXIT
SEROUT sPin, sBaud, [noparse][[/noparse]char]
eeAddr = eeAddr + 1
LOOP
RETURN
-- Jon Williams
-- Parallax
In a message dated 1/9/2003 4:13:07 PM Central Standard Time,
brownstamp@y... writes:
> I need a way of sending text commands to an RS232 device (a dimmer
> controller)based on certain conditions of a DVD player which
> provides me with frame information. All the interfacing is worked
> out but what I need is a way of storing the string commands in
> variables. That will minimize the code I have to write. But as you
> know I can only store one asci letter in a byte. I would love to be
> able to put all my string commands in a list and then do lookup of
> the item that I want based on the info I receive from the DVD and
> then send that item to the dimmer.
>
> If the above is vague I can explain further...
>
>
> Al Najjar
[noparse][[/noparse]Non-text portions of this message have been removed]
This is helpful. The problem is not the Pioneer 7400 but
manipulating large amount of text for serial com. The Stamp is not
well equiped for that.
many thanks,
Al
--- In basicstamps@yahoogroups.com, "hazemarie <hazemarie@y...>"
<hazemarie@y...> wrote:
> Why not use branching or subroutines?
>
> STFR=10 'start frame
> DVD:
> serout DVDTX,BAUD,1,[noparse][[/noparse]"FR",dec STFR,"SE",cr]
> serin DVDRX,BAUD,6000,UHOH2,[noparse][[/noparse]wait("R")]
> serout DVDTX,BAUD,1,[noparse][[/noparse]"PL",cr]
> serin DVDRX,BAUD,6000,UHOH2,[noparse][[/noparse]wait("R")]
> pause 3000
>
> ENDFR=1000 'end frame
> chk1: 'plays to frame 1000 then does something
> TKO=0 ' set timeout lockup counter back to 0
> serout DVDTX,BAUD,1,[noparse][[/noparse]"?F",cr]
> serin DVDRX,BAUD,6000,UHOH3,[noparse][[/noparse]dec CURFR,wait(cr)]
> 'DEBUG "CURRENT FRAME = ", dec CURFR, CR
> if CURFR=>ENDFR then DIM1
> goto chk1
> DIM1:
> serout dimtx, baud2,1,[noparse][[/noparse]"WHATEVER1",CR]
> serin dimrx, baud2, 6000, UHOH4,[noparse][[/noparse]wait("R")]
> ENDFR=2000
> chk2:
> TKO=0 ' set timeout lockup counter back to 0
> serout DVDTX,BAUD,[noparse][[/noparse]"?F",cr]
> serin DVDRX,BAUD,6000,UHOH3,[noparse][[/noparse]dec CURFR,wait(cr)]
> 'DEBUG "CURRENT FRAME = ", dec CURFR, CR
> if CURFR=>ENDFR then DIM2
> goto chk1
> DIM2:
> serout dimtx, baud2,[noparse][[/noparse]"WHATEVER2",CR]
> serin dimrx, baud2, 6000, UHOH4,[noparse][[/noparse]wait("R")]
> .
> .
> .
> etc.
>
> I could probably help you with some stamp code to control the
pioneer
> DVD-V7400 if you like.
>
> -Marie
to EEPROM? I have about 90 text messages.
Al
--- In basicstamps@yahoogroups.com, jonwms@a... wrote:
> Here's an efficient way to implement a list of strings and send
them as you
> need:
>
> Msg1 DATA "This is message 1", 0 ' zero-
terminated strings
> Msg2 DATA "This is message 2", 0
>
> Main:
> ' some code -- determine which message to send; put value in
msgNum
>
> LOOKUP msgNum, [noparse][[/noparse]Msg1, Msg2], eeAddr ' get pointer
to string
> GOSUB Send_String
>
> ' clean-up code after sending message
> GOTO Main
>
>
> Send_String:
> READ eeAddr, char
> IF (char = 0) THEN Send_String_Exit
> SEROUT sPin, sBaud, [noparse][[/noparse]char]
> eeAddr = eeAddr + 1
> GOTO Send_String
>
> Send_String_Exit:
> RETURN
>
>
> Send_String_25: ' for PBASIC 2.5
> DO
> READ eeAddr, char
> IF (char = 0) THEN EXIT
> SEROUT sPin, sBaud, [noparse][[/noparse]char]
> eeAddr = eeAddr + 1
> LOOP
> RETURN
>
>
> -- Jon Williams
> -- Parallax
>
>
> In a message dated 1/9/2003 4:13:07 PM Central Standard Time,
> brownstamp@y... writes:
>
> > I need a way of sending text commands to an RS232 device (a
dimmer
> > controller)based on certain conditions of a DVD player which
> > provides me with frame information. All the interfacing is
worked
> > out but what I need is a way of storing the string commands in
> > variables. That will minimize the code I have to write. But as
you
> > know I can only store one asci letter in a byte. I would love
to be
> > able to put all my string commands in a list and then do lookup
of
> > the item that I want based on the info I receive from the DVD
and
> > then send that item to the dimmer.
> >
> > If the above is vague I can explain further...
> >
> >
> > Al Najjar
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
tokens -- the compiler will tell you. You can monitor your EEPROM use with
the Memory Map button/menu selection.
DATA statements build from the bottom up (unless you specify a different
location) and program tokens build from the top down. When they meet in the
middle your memory is full.
-- Jon Williams
-- Parallax
In a message dated 1/9/2003 10:40:04 PM Central Standard Time,
brownstamp@y... writes:
> What is the limit on the number of these Data item that I can write
> to EEPROM? I have about 90 text messages.
>
>
> Al
[noparse][[/noparse]Non-text portions of this message have been removed]