parallel LCD and 2 cogs
wolphi
Posts: 8
I just started programming the propeller chip and I run into a problem which I can't solve.
I am displaying text or numbers on my 8bit 16x2 display using the LCD driver from Simon Ampleman which I found in the Object exchange. Everything works fine until I stated playing with the cogs.
I am using the following 2 files:
' test.spin
OBJ
LCD : "LCD_16x2_8bit"
t : "test1"
PUB main | a
LCD.START
repeat a from 99 to 1
LCD.MOVE(5,1)
LCD.DEC(a)
t.test123
'test123.spin
VAR
LONG stack[noparse][[/noparse]90]
OBJ
LCD : "LCD_16X2_8BIT"
PUB test123 |a
coginit(2,print,@stack) 'start new cog for display
repeat 'count endless
PUB print | a ' count from 1 to 10000 and display on LCD
LCD.START
repeat a from 1 to 10000
LCD.MOVE(5,1)
LCD.DEC(a)
When I start test.spin the propeller counts from 99 back to 1 and it shows the number on the LCD. Then I call the method test123 which starts a new cog and runs the method print. At this point the LCD shows weird symbols. When I call method print without starting a new cog the display shows the correct number.
VAR
LONG stack[noparse][[/noparse]90]
OBJ
LCD : "LCD_16X2_8BIT"
PUB test123 |a
print
PUB print | a ' count from 1 to 10000 and display on LCD
LCD.START
repeat a from 1 to 10000
LCD.MOVE(5,1)
LCD.DEC(a)
I need to run the LCD in a different cog because I need to display a variable at the same time when another cog is doing something else.
Any help would be appreciated !!
Thanks,
Wolfgang
I am displaying text or numbers on my 8bit 16x2 display using the LCD driver from Simon Ampleman which I found in the Object exchange. Everything works fine until I stated playing with the cogs.
I am using the following 2 files:
' test.spin
OBJ
LCD : "LCD_16x2_8bit"
t : "test1"
PUB main | a
LCD.START
repeat a from 99 to 1
LCD.MOVE(5,1)
LCD.DEC(a)
t.test123
'test123.spin
VAR
LONG stack[noparse][[/noparse]90]
OBJ
LCD : "LCD_16X2_8BIT"
PUB test123 |a
coginit(2,print,@stack) 'start new cog for display
repeat 'count endless
PUB print | a ' count from 1 to 10000 and display on LCD
LCD.START
repeat a from 1 to 10000
LCD.MOVE(5,1)
LCD.DEC(a)
When I start test.spin the propeller counts from 99 back to 1 and it shows the number on the LCD. Then I call the method test123 which starts a new cog and runs the method print. At this point the LCD shows weird symbols. When I call method print without starting a new cog the display shows the correct number.
VAR
LONG stack[noparse][[/noparse]90]
OBJ
LCD : "LCD_16X2_8BIT"
PUB test123 |a
PUB print | a ' count from 1 to 10000 and display on LCD
LCD.START
repeat a from 1 to 10000
LCD.MOVE(5,1)
LCD.DEC(a)
I need to run the LCD in a different cog because I need to display a variable at the same time when another cog is doing something else.
Any help would be appreciated !!
Thanks,
Wolfgang
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Searider
When I call the START method·from LCD driver in the second cog the LCD is getting inizialized and the first cog has finshed sending data to the display. I think I am missing something but what?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.co.uk
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
BTW: I type as I'm thinking, so please don't take any offense at my writing style
If it is not Stop.
It is not ned to start it 2 times.
Only Call its funktions in program
[noparse][[/noparse]code]
·· PUB test123 |a
··· coginit(2,print,@stack) 'start new cog for display
··· repeat 'count endless
··· PUB print | a ' count from 1 to 10000 and display on LCD
··· LCD.START ................................................................... Repeat starts ... ned only one time
··· repeat a from 1 to 10000
·· LCD.MOVE(5,1)
·· LCD.DEC(a)
[noparse][[/noparse]/code]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
Sapieha
Post Edited (Sapieha) : 5/3/2008 7:49:21 PM GMT
But
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
Sapieha
After lots of coffee I solved the problem. Its is very simple. When I used LCD.START all the DB0 to DB10 are set to 1. When I try to display something with the second cog DB0 to DB10 are still used by the first cog and only some weird character will appear on the LCD
Solution: I added a function STOP into the driver (thanks Sapieha) which sets all the pins related to the display to 0. Before I call the second cog to display something I call the method STOP in my first cog and everything works fine.