Spin, OLED-Prop-96 & FullDuplexSerial Question.
JMLStamp2p
Posts: 259
Good morning all,
I have a OLED-96 Prop Display·and have the "uOLED-96-Prop_V4" driver running as well as the sample graphics code as listed below in my App. My question is this:
If I include the FullDuplexSerial Driver in the App. as well I want to make sure that I am not causing confusion
on the outputs driving the Display. From what I understand Pins 20 & 21 are avilable to the user on the OLED-96. How would I adjust the code to transmit out on Pin 20 using the Transmit OBJ in FullDuplexSerial ? "I want to make sure that I·am·Referencing right." Also, After I have downloaded the program I want to power the OLED-96 via +5 volts alone and monitor the data coming out of pin 20 with my scope. If their is anything that needs to be adjusted in this code fragment please let me know.
Thanks,
JMLStamp2p
'...........................................................................
'...........................................................................
· _CLKMODE····· = XTAL1 + PLL16X·······················
· _XINFREQ····· = 8_000_000
· dSlow········ = 50
· dFast········ = 20
OBJ
· OLED· : "uOLED-96-Prop_V4"
· DELAY : "Clock"
· DATA : "FullDuplexSerial"········· 'Is this Referenced right ?
'..................................................
PUB MAIN
· DELAY.Init(8_000_000)
· OLED.InitOLED
· OLED.CLS
· REPEAT
··· Transmit
····Splash
·'.................................................
· data.serial.tx(01)·························· 'If Im going to use the Tx·method in FullDuplexSerial do I need·····
·································································'to·Referance it this way ? And how would I adjust the code to
································································ 'send the data "01" out on Pin 20 at 9600 baud, 1-Stop bit, no
·································································'parity ?
· data.serial.start(1,0,%0000,9600)
· data.serial.tx(01)
PUB Splash
· oled.putChar ("4", 1,1,1, 255,255,255)
· oled.putChar ("D", 2,1,1, 255,255,255)
··
· oled.putChar ("S", 4,1,1, 255,255,255)
· oled.putChar ("y", 5,1,1, 255,255,255)
· oled.putChar ("s", 6,1,1, 255,255,255)
· oled.putChar ("t", 7,1,1, 255,255,255)
· oled.putChar ("e", 8,1,1, 255,255,255)
· oled.putChar ("m", 9,1,1, 255,255,255)
· oled.putChar ("s", 10,1,1,255,255,255)
· delay.PauseSec(2)
I have a OLED-96 Prop Display·and have the "uOLED-96-Prop_V4" driver running as well as the sample graphics code as listed below in my App. My question is this:
If I include the FullDuplexSerial Driver in the App. as well I want to make sure that I am not causing confusion
on the outputs driving the Display. From what I understand Pins 20 & 21 are avilable to the user on the OLED-96. How would I adjust the code to transmit out on Pin 20 using the Transmit OBJ in FullDuplexSerial ? "I want to make sure that I·am·Referencing right." Also, After I have downloaded the program I want to power the OLED-96 via +5 volts alone and monitor the data coming out of pin 20 with my scope. If their is anything that needs to be adjusted in this code fragment please let me know.
Thanks,
JMLStamp2p
'...........................................................................
'...........................................................................
· _CLKMODE····· = XTAL1 + PLL16X·······················
· _XINFREQ····· = 8_000_000
· dSlow········ = 50
· dFast········ = 20
OBJ
· OLED· : "uOLED-96-Prop_V4"
· DELAY : "Clock"
· DATA : "FullDuplexSerial"········· 'Is this Referenced right ?
'..................................................
PUB MAIN
· DELAY.Init(8_000_000)
· OLED.InitOLED
· OLED.CLS
· REPEAT
··· Transmit
····Splash
·'.................................................
· data.serial.tx(01)·························· 'If Im going to use the Tx·method in FullDuplexSerial do I need·····
·································································'to·Referance it this way ? And how would I adjust the code to
································································ 'send the data "01" out on Pin 20 at 9600 baud, 1-Stop bit, no
·································································'parity ?
· data.serial.start(1,0,%0000,9600)
· data.serial.tx(01)
PUB Splash
· oled.putChar ("4", 1,1,1, 255,255,255)
· oled.putChar ("D", 2,1,1, 255,255,255)
··
· oled.putChar ("S", 4,1,1, 255,255,255)
· oled.putChar ("y", 5,1,1, 255,255,255)
· oled.putChar ("s", 6,1,1, 255,255,255)
· oled.putChar ("t", 7,1,1, 255,255,255)
· oled.putChar ("e", 8,1,1, 255,255,255)
· oled.putChar ("m", 9,1,1, 255,255,255)
· oled.putChar ("s", 10,1,1,255,255,255)
· delay.PauseSec(2)
Comments
·PUB Transmit
· data.serial.start(1,0,%0000,9600)
· data.serial.tx(01)
Did not copy and paste right· ....
JMLStamp2p
·
I am not sure where you are getting the "serial" in "data.serial.tx(01)". I believe "data.tx(01)" will suffice.
Lucidman
1) The syntax for calling methods in other objects is only: obj.methode(parameter)
so you call your serial object with data.tx and data.start. (But I suggest to take another name instead of "data", perhaps "serial"?)
2) Have a look at the Start methode of the FullDuplexSerial:
First parameter is the Receive pin number, second the Transmit pin number.
So your code would transmit on PA0 and receive on PA1.
The FullDuplexSerial uses always 8 data- and 1 stopbit and no parity.
3) If you write: data.tx(01) you send the ASCII code 1 (or in other words a byte with the value 1).
Is that what you want? If you will send 2 characters "01" then you have a lot of possibilities:
depends on what the code should do...
Andy
In your case, since you have 'OBJ data : "FullDuplexSerial"', you use "data.start()" and "data.tx()".
For actually transmitting, do you want the characters "0", then "1", or do you want the binary values 0, then 1?
In the first case, you'd put 'data.tx("0")', then 'data.tx("1")'.
In the second case, you'd put 'data.tx(0)', then 'data.tx(1)'.
Your start call would have to be 'data.start(20,20,%1000,9600)' assuming that you don't need to receive anything.
I've set both transmit and receive pins the same (since you don't need receive) and the mode bit set to 1 simply
throws away an input character for each one transmitted since transmitted characters will be echoed this way.
If you want to receive, just change the first pin # to whatever you want to use and make the mode %0000.
What you're trying to do is really pretty straight-forward if you just keep reminding yourself that the 96-PROP is just a Prop Dev board with a display and uSD card.
Just playing around yesterday, I put together a small project that uses the 96-PROP to run the uOLED-160-GMD1 demo (code for the object and demo can be found in the Object Exchange. By Duffer, I think). I added the uOLED-96-PROP object and added some lines to the 160 demo to output text to the 96-prop screen for each segment of the 160 demo (kind of like a "debug" screen or console for what the 96-PROP was doing).
It works nicely and the hookup is really clean (both displays are running off the same uUSB-CE5 for programming the 96-PROP and powering the whole system while it's running. See pics below.
I'll PM you the modified code (zipped up into an archive created within the Propeller tool) if you want so you can see what changes were made to the "stock" code. (uOLED-160-GMD1.spin (changed to use pins 18 and 19 for serial) and uOLED-160-GMD1_Demo (to insert the code to output text to the 96-PROP while running the demo)) and how the "project" goes together.
Adoy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
One's true identity can only be learned through reflection.
I understand and appreciate your comments, makes sense. Adoy, I also have a 160-GMD1 and look forward to looking at your code.
Much appreciated,
JMLStamp2p