Spin code topic (simple)
Pridbor
Posts: 30
Can somebody please help me out with this most likely simple question?
I have spent more time than I care to admit to to find out why the first 3
SendData routine doesn't work, while the second one LED.SendData does
work perfectly.
The working one refers to an object made by Beau for the 4D Display Demo,
and I literally copied the code and entered it into my test code!
(I do have the PropBOE annd the Display working via the interconnect Beau was
nice to provide me) Been playing around quite a bit but am getting stuck on this one.
I'm also looking for another routine that sends a hex byte but that's the next problem :-)
Thanks in advance
Preben
Cmd := $010F
SendData(Cmd) ''Send 15
SendData($0000)
SendData($0F01)
LED.SendData(Cmd) ''Send 15
LED.SendData($0000)
LED.SendData($0F01)
time.Pause(500)
LED.sndhex(Cmd) '' send 115
LED.sndhex($0100)
LED.sndhex($737C)
pri SendData(Data) ''Send Word variable to the uOLED display
ser.char(Data.byte[1])
ser.char(Data.byte[0])
I have spent more time than I care to admit to to find out why the first 3
SendData routine doesn't work, while the second one LED.SendData does
work perfectly.
The working one refers to an object made by Beau for the 4D Display Demo,
and I literally copied the code and entered it into my test code!
(I do have the PropBOE annd the Display working via the interconnect Beau was
nice to provide me) Been playing around quite a bit but am getting stuck on this one.
I'm also looking for another routine that sends a hex byte but that's the next problem :-)
Thanks in advance
Preben
Cmd := $010F
SendData(Cmd) ''Send 15
SendData($0000)
SendData($0F01)
LED.SendData(Cmd) ''Send 15
LED.SendData($0000)
LED.SendData($0F01)
time.Pause(500)
LED.sndhex(Cmd) '' send 115
LED.sndhex($0100)
LED.sndhex($737C)
pri SendData(Data) ''Send Word variable to the uOLED display
ser.char(Data.byte[1])
ser.char(Data.byte[0])
Comments
this is all the code there is, as I tried to eliminate any code which might have sent me off course
I have attached the entire program below
Thanks for your suggestion
Preben
{{
*******************************************
* Test programming of Display programmed *
* in ViSi Genie *
* uLCD(SK)-32PTU display *
* Author: *
* *
*******************************************
File: Drive LCD-32PTU
}}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5000000
rxpin = 0
txpin = 1
reset = 2
OLEDBaud = 9600
obj
LED : "PJ_uLCD(SK)-32PTU_v2.0"
ser : "Parallax Serial Terminal" ''Used ONLY For DEBUGGING
time : "Timing"
var 'Used ONLY for DEMO
word Cmd, Hex1, Hex2 , Hex3 , Hex4, Hex5 , Hex6
byte Cmd1, Cmd2, Cmd3, Val1, Val2, CmdCS, CS
pub mainDEMO
if ina[31] == 0 '' Check to see if USB port is powered
outa[30] := 0 '' Force Propeller Tx line LOW if USB not connected
else
ser.Start(19200) ''Used ONLY For DEBUGGING
LED.start(rxpin, txpin, reset, OLEDBaud) ''Starts uOLED display
Cmd1 := $01
Cmd2 := $0F
Cmd3 := $00
Val1 := $00
Val2 := $0F
CS := $01
Cmd := $010F
SendData(Cmd) ''Send 15
SendData($0000)
SendData($0F01)
LED.SendData(Cmd) ''Send 15
LED.SendData($0000)
LED.SendData($0F01)
time.Pause(500)
LED.sndhex(Cmd) '' send 115
LED.sndhex($0100)
LED.sndhex($737C)
pri SendData(Data) ''Send Word variable to the uOLED display
ser.char(Data.byte[1])
ser.char(Data.byte[0])
Is there a particular reason why you want to move SendData up one level or rather why you want to talk to the display from different objects?
Please wrap your code in [noparse] [/noparse] tags.
your same comments to him :-) Maybe due to it's small size in length and width?
Didn't expect to include the [] thanks for the education will do in the future :-)
trying to avoid going between different tags and search for the small piece of code of
interest to me.
BUT, as mentioned I'm really looking for the routine which will do a hex byte transfer. The
sndhex() which is just calling SendData() is sending a word and I need it to be in byte format
such that I can create a dynamic command structure and calculate a checksum to be sent
to the Display. I know that I can extract and do the calculation and then form a word etc but
it seems to be a very inefficient and complex way for a simple problem, or?
Can you propose a routine for me? I did try the "char()" which I thought that SendData() uses and also hex()
both to no avail.
Thanks again for taking the time
Preben