Shop OBEX P1 Docs P2 Docs Learn Events
Extract data from DAT block for display and control — Parallax Forums

Extract data from DAT block for display and control

amerroamerro Posts: 3
edited 2011-03-14 18:31 in General Discussion
Hi
I am very new to Propeller and seek some help.
I am including a small portion of a program which is supposed to extract data from a Dat block and display it on a LCD.
Data gets displayed by not what is wanted.
I have included notes in my request for assistance but in short I aim to index the dat array and display that string of data.
I need some guidance on the extraction format and how to construct the output string.

Peter

{This is pastings from my main program which basically looks at a set of conditions configured from
input pins and routines, makes a selection based on those conditions , and from the two routines Upset and Dwnset
selects the correct data string from the DAT field for display and control of processes.

I am unsure of the correct method to extract the fields from DAT for display and control}





PUB DisplayWrite(itemno)

LCD.cleardisplay
waitcnt(clkfreq/100 + cnt)
LCD.outSTR(string("test this line")) ' This line displays ok

]LCD.outstr(???????????????????) ' what line of code is required in place of ?? to
'take a line of text from the data field indexed by (itemno) and displayed
'as the second line in a two line display.
Pub Upset ' up routine

If index => 1 and index < 8
index ++

else
index := 8
displaywrite(index)
Pub Dwnset 'down routine

If index =< 8 and index > 1
index --

else
index := 1
displaywrite(index)

Dat
textA byte "??????????" , ........"?????" ' this is display data
contdat byte (%10101010), .........(%01010101) 'this is control signal data

'I am unsure of the format in the area ??? to be able to
' index the strings out referenced by the index set in UPSET and Dwnset

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-03-14 18:31
    You did not provide enough information but if the snippet below works then the outSTR method requires a pointer as an argument and assumes a zero as a string terminator.
    LCD.outSTR(string("test this line")) ' This line displays ok
    

    Therefore...
    DAT
      message       byte    "Hello World",  0
    
    ....code.....
    
    LCD.outSTR(@message)
    

    It easier to help if you post all your code including the objects or at least the name of the object code. A bunch of ????? is confusing. Explain what you expect the code to do and the actual result.
Sign In or Register to comment.