Some more info about about error problem thought to be related to file name. Files that wouldn't compile I been able to make compile by:
1. Saving the pbas file in another new directory that didn't contain the generated Spin file on compiler error.
2. The second file I got to work showed the same errors as the screenshot above, but the real error was I had a missing ENDIF. The error message never showed that.
I don't know if these items would be considered bugs or not. Also, any thoughts on why saving pbas files to new directory allows the files to compile and not in the old directory? I even tried erasing the Spin files generated by failed compile and that didn't help.
Thanks.· I tried the code that you suggested and it did not work.
Here is what I tried:
' Reads the temperature from a Dallas DS18B20
' Converts it to ascii and sends it to the PC
' Connect DS18B20 DQ pin to PIN 1 on the propeller
' Don't forget the 4.7K pullup resistor too...
'
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
' Define CONs
Baud CON "T115200"
' Define PINs
DQPin PIN 16 INPUT ' 1-Wire communication pin to DS18B20
TX PIN 30 HIGH ' Send data back to PC
ID1 DATA 10, $55,$46,$00,$00,$02,$7C,$B1,$D5,$28,$44 ' Number of bytes, data bytes
ID2 DATA 10, $55,$46,$00,$00,$02,$7C,$B1,$D5,$28,$BE ' Number of bytes, data bytes
value VAR LONG
SendID SUB 1 ' Parameter is a DATA label
'--------------------------------------------------------
' Jon McPhalen's TX formatting SUBs.
'--------------------------------------------------------
'
' [url=http://forums.parallax.com/showthread.php?p=907567]http://forums.parallax.com/showthread.php?p=907567[/url]
'
LOAD "tx_format_def.pbas" ' formatting for SEROUT
PROGRAM Start
Start:
DO
SendID ID1
PAUSE 750 ' Wait for conversion
SendID ID2
OWREAD DQPin, value\16
TX_STR "1 - "
TX_BIN value,16
TX_BYTE CR
LOOP
END
'--------------------------------------------------------
' Jon McPhalen's TX formatting SUBs.
'--------------------------------------------------------
'
' [url=http://forums.parallax.com/showthread.php?p=907567]http://forums.parallax.com/showthread.php?p=907567[/url]
'
LOAD "tx_format_inc.pbas"
SUB SendID
RDBYTE __param1, __param2 ' Get number of bytes
INC __param1 ' Point to 1st data byte
DO
RDBYTE __param1, __param3 ' Get a data byte
OWWrite DQPin, __param3 ' Send data byte
INC __param1 ' Point to next data byte
LOOP __param2 ' Repeat "__param2" times
ENDSUB
The result was:
1 - 1111111111111111
I don't think it likes it when the bytes are sent in separate commands.· When I use your demo program
··· OWWRITE DQPin, $44CC\16
works, but
··· OWWRITE DQPin, $44\8 ··· OWWRITE DQPin, $CC\8
doesn't.
Have you tried it?· Maybe ther is something wrong with my setup.· I've got a 1K resistor between pin 16 and the DS18B20 and a 4.7K pull up resistor between the external 5V supply and the DS18B20.
Bean said... · In the command "OWWRITE DQPin, $44CC\16" the $CC is sent first (because MSB is always sent first), then $44 is sent.
· Maybe that is the problem ???
Hmmm...that could be.· So I should send $BE,$46,$00,$00,$02,$7C,$B1,$D5,$28,$55?
Then Bean said...
P.S.· The 1K resistor may be causing problems. Just run the DS18B20 from 3.3V and eliminate the 1K (keep the 4.7K pullup to 3.3V).
Ok...I can do that.· I'm running it off 5V because everything that I will be interfacing to likes 5V but I can take it out for testing.· Johnny Mac's Spin program works fine and it looks like he's sending $55...$BE.
CON
MATCH_ROM = $55
RD_SPAD = $BE
ow.reset
ow.write(MATCH_ROM)
repeat idx from 0 to 7
ow.write(byte[noparse][[/noparse]snpntr+idx])
ow.write(RD_SPAD)
I'm running his stuff against the same setup that I'm using for my testing.
Then Bean said...
P.P.S. You're not trying to use parasitic power are you ?
Heck no.
I've got to go to Ottawa for my day job tomorrow so I won't get to test the changes until tomorrow evening.· I'll post my results.
Hank,
If you send byte at a time, then you send it in the forward order. For example to send $01, $02, $03, $04 byte at a time you would send $01, $02, $03, $04.
But if you sent the sequence using words you would send $0201, then $0403.
I hope that makes sense.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life: · 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
Ok...so do you want the good news or the bad news?
First...the·bad news.
I took out the 1K resistor and powered the DS18B20 from 3.3V.· It didn't work.
Now, the good news.
It works.
I modified Bean's DS18B20 demo to send te two bytes in the correct order when I switched from sending a word to sending a byte.· That worked.
I tossed in a·term.hex(byte[noparse][[/noparse]snpntr+idx], 2)·to Johnny Mac's modified DS1822 demo program to dump the SN as he wrote it to the 1-wire bus.· It turns out that it doesn't go out to the 1-wire bus as 46, 00, 00, 02, 7C, B1, D5, 28 but as 28,· D5,·B1, 7C, 02, 00, 00, 46.· I changed Bean's DS18B20 demo to send the bytes in he correct order and that worked.
So...I switches back to using the 1K resistor and powering the DS18B20 with 5V and that works.
Thanks to everyone, especially Bean and Johnny Mack for kicking me in the right direction.· I really appreciate the fact that everyone was so gentle with me given that I'm new to the forum and was clearly spinning.· I'm really enjoying the Propeller and PropBASIC and am really keen to get my projects moving forward.
P.S. You shouldn't need the "\8" in the OWWRITE lines because 8 bits is the default.
Ahhh...cool...thanks.
I have written parsers in the past and I know it's a pill...but...it would be super awesome if you could extend the OWWrite at some point to allow multiple variables on the same line.· I know how to make it work now and I know I'm being lazy but that's just the way I roll.
caskaz said...
And what is "\" in "OWWRITE DQPin, $55\8"?
The "\8" tells OWWRITE to write 8 bits.· Bean pointed out that it wasn't necessary given that the command defaults to writing 8 bits.· I included it because the original command was OWWRITE DQPin, $BE55\16 and when I split it up I added a "\8" to each line.
~S!~
I looked at the prop.. and almost got it. Just it is limited with the VGA and how much I can push it.
There was a thread about the PROP and the color display that parallax sells, can't do what I need. Ho well...
So I'll stickwith my BS2P24 enough horsepower, and the display and stuff is done in VB2008.. works like a charm.
One day, if I can get enough support and understanding, and don't get that &^%$#@ RTFM, as a newbie, I might evolve..
By the way, you can see lib-file on BST-window?
There is not it inside list on BST-window on my PC(vista).
Althoth there is lib-file on explorer on vista, it cannot open.
~S!~
Because I need lots of graphics, it is the PROP that does not have enough mem to push to more than one display(maximum setting).
So, with a Notebook Acer One Aspire, and a USB Monitor, I will have enough display to get it all going.
That display, will it be for the PROP? or the PC side...
Yosh
It is going to be driven by the Propeller (if we can make it work.)· We only need character display for what we are doing.· Eventually adding graphics may be good but for now we don't need it.
My first crack at it will be with the monochrome 4x20 LCD and the Blackberry trackball with 4 directions and click.· I'm going to use the LEDs under the trackball to indicate status (green is good, red is bad, flashing red is very bad sort of thing.)
The temperature is·· 25.0000 Degrees C
The temperature is·· 25.0000 Degrees C
The temperature is·· 24.8750 Degrees C
The temperature is·· 24.8125 Degrees C
The temperature is·· 24.7500 Degrees C
The temperature is·· 24.5625 Degrees C
to this:
My six DS18B20s said...
The temperature is -· 1.8125 Degrees C
The temperature is - 21.6250 Degrees C
The temperature is - 32.0000 Degrees C
The temperature is - 22.3125 Degrees C
The temperature is -· 5.1250 Degrees C
The temperature is·· 10.8750 Degrees C
So...I guess I can say that it is working now.· I'm giddy with excitement.· Or...it could be all the cryo spray in my little straw bale shed.
Hi,
LMAO,
I used a cube of ice to test my ds18b20. Did not go as low and as fast!
What I like about them is , they react really fast. from an ice cube to a hot coffee cup, was about 10 secs or so (not timed).
So, they are really sensitive to changes and fast too...
Good Video ...
Cheers
Yosh
1-Wire can be very persnickety, which is why I tend to shy away from it most of the time. That said, when you need a temperature sensor and a unique serial number in a device using 1-Wire is very convenient.
I finally found the "sweet spot" with 1-Wire vis-a-vis PropBASIC. I've attached a "work" file that demonstrates how to read the serial # from a DS1822 and then send it back to read from that device. What you want to avoid is using more than one "big" PropBASIC command in a program as each is converted to assembly inline and consumes precious cog space. My demo wraps all of the 1-Wire commands into subs/funcs so they only compile once, and I've added OW_READ_SN and OW_WRITE_SN to read and write serial numbers from the buss.
Now that this seems to be working well I will move the 1-Wire routines to a library.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Althouh unzipped ow_work_v2.zip, I cannot find delays.lib/pst_serial.lib inside ow_work_v2's folder on BST-window.
ow_work_v2.pbas's compile-information is no error.
I just downloaded the ZIP -- those files are included. I keep my .PBAS and .LIB files in the same folder and PropBASIC-BST.exe; you might give that a try.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Hi Jonny.
I copied delays.lib/pst_serial.lib/ow_work_v2.pbas to PropBasic-bst-00.00.99-67's folder. (there is PropBasic-bst.exe inside folder)
Opened BST-window.
I opend PropBasic-bst-00.00.99-67's folder, but I cannot see lib-file on list.
I understand now. Bean and I collectively decided on ".lib" but it may not be supported by BST (for display in the file pane, that is) -- you'll have to talk to Brad about that. You can open the files by using the Open dialog and then putting *.lib in the file filter.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
JonnyMac said...
I understand now. Bean and I collectively decided on ".lib" but it may not be supported by BST (for display in the file pane, that is)
It's not. I'll add *.lib to the *.pbas settings for the next release.
<edit> If you select the (*.*) option in the file selector it should work anyway right now.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Are you suggesting coconuts migrate?"
Comments
When are you going to update demos.zip to reflect the change in GETADDR command?
Ben
I just uploaded a new demos.zip file this morning.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
1. Saving the pbas file in another new directory that didn't contain the generated Spin file on compiler error.
2. The second file I got to work showed the same errors as the screenshot above, but the real error was I had a missing ENDIF. The error message never showed that.
I don't know if these items would be considered bugs or not. Also, any thoughts on why saving pbas files to new directory allows the files to compile and not in the old directory? I even tried erasing the Spin files generated by failed compile and that didn't help.
Thanks,
Tony
Thanks.· I tried the code that you suggested and it did not work.
Here is what I tried:
The result was:
1 - 1111111111111111
I don't think it likes it when the bytes are sent in separate commands.· When I use your demo program
··· OWWRITE DQPin, $44CC\16
works, but
··· OWWRITE DQPin, $44\8
··· OWWRITE DQPin, $CC\8
doesn't.
Have you tried it?· Maybe ther is something wrong with my setup.· I've got a 1K resistor between pin 16 and the DS18B20 and a 4.7K pull up resistor between the external 5V supply and the DS18B20.
Need a drawing?
Hank.
·
· In the command "OWWRITE DQPin, $44CC\16" the $CC is sent first (because MSB is always sent first), then $44 is sent.
· Maybe that is the problem ???
P.S.· The 1K resistor may be causing problems. Just run the DS18B20 from 3.3V and eliminate the 1K (keep the 4.7K pullup to 3.3V).
P.P.S. You're not trying to use parasitic power are you ?
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
Post Edited (Bean) : 5/26/2010 10:00:20 PM GMT
Ok...I can do that.· I'm running it off 5V because everything that I will be interfacing to likes 5V but I can take it out for testing.· Johnny Mac's Spin program works fine and it looks like he's sending $55...$BE.
I'm running his stuff against the same setup that I'm using for my testing. Heck no.
I've got to go to Ottawa for my day job tomorrow so I won't get to test the changes until tomorrow evening.· I'll post my results.
Thanks for your help.
Hank.
If you send byte at a time, then you send it in the forward order. For example to send $01, $02, $03, $04 byte at a time you would send $01, $02, $03, $04.
But if you sent the sequence using words you would send $0201, then $0403.
I hope that makes sense.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
First...the·bad news.
I took out the 1K resistor and powered the DS18B20 from 3.3V.· It didn't work.
Now, the good news.
It works.
I modified Bean's DS18B20 demo to send te two bytes in the correct order when I switched from sending a word to sending a byte.· That worked.
I tossed in a·term.hex(byte[noparse][[/noparse]snpntr+idx], 2)·to Johnny Mac's modified DS1822 demo program to dump the SN as he wrote it to the 1-wire bus.· It turns out that it doesn't go out to the 1-wire bus as 46, 00, 00, 02, 7C, B1, D5, 28 but as 28,· D5,·B1, 7C, 02, 00, 00, 46.· I changed Bean's DS18B20 demo to send the bytes in he correct order and that worked.
So...I switches back to using the 1K resistor and powering the DS18B20 with 5V and that works.
This works:
Everything is good.
On another note...I've ordered one of these:
and one of these:
and can now move forward with my development.
Thanks to everyone, especially Bean and Johnny Mack for kicking me in the right direction.· I really appreciate the fact that everyone was so gentle with me given that I'm new to the forum and was clearly spinning.· I'm really enjoying the Propeller and PropBASIC and am really keen to get my projects moving forward.
Hank.
·
I glad you got it working.
P.S. You shouldn't need the "\8" in the OWWRITE lines because 8 bits is the default.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
I have written parsers in the past and I know it's a pill...but...it would be super awesome if you could extend the OWWrite at some point to allow multiple variables on the same line.· I know how to make it work now and I know I'm being lazy but that's just the way I roll.
Hank.
·
I updated PropBASIC-bst-00.00.99-67 & bst-0.19.3.
I cannot open lib-file(VGA.lib serial.lib etc) on BST-window.
Need another editor?
And what is "\" in "OWWRITE DQPin, $55\8"?
What's it mean?
caskaz
Hank.
·
Just off topic , for H Carr, you look familiar to me... from Ottawa, 340 Laurier..
Yosh
hank@dna.ca
Hank.
·
I was you worst nightmare... from NPB then to CSC. Marc Lavigne
Yosh..
Sorry for hacking the thread...
EDIT *
Yeah just sent email. from DND.. ;-)
I tried to go back to CSC.. got filtered out each time.. DHO !
~S!~~
Post Edited (Yoshti) : 5/28/2010 4:14:30 PM GMT
You can email me at hank@dna.ca instead of continuing this on the thread (unless the others want to read this.)
Oh...and...I'm sitting at 170 Laurier now.
Hank.
·
I looked at the prop.. and almost got it. Just it is limited with the VGA and how much I can push it.
There was a thread about the PROP and the color display that parallax sells, can't do what I need. Ho well...
So I'll stickwith my BS2P24 enough horsepower, and the display and stuff is done in VB2008.. works like a charm.
One day, if I can get enough support and understanding, and don't get that &^%$#@ RTFM, as a newbie, I might evolve..
By the way, you can see lib-file on BST-window?
There is not it inside list on BST-window on my PC(vista).
Althoth there is lib-file on explorer on vista, it cannot open.
caskaz
Have you looked at these?· Lots of grunt.
http://propmodule.com/catalog/product_info.php?cPath=58&products_id=48&osCsid=0732bf952927103eee28f46e0423082a
We're working on drivers for the Kyocera 5.7" flat panel.
Hank.
Because I need lots of graphics, it is the PROP that does not have enough mem to push to more than one display(maximum setting).
So, with a Notebook Acer One Aspire, and a USB Monitor, I will have enough display to get it all going.
That display, will it be for the PROP? or the PC side...
Yosh
My first crack at it will be with the monochrome 4x20 LCD and the Blackberry trackball with 4 directions and click.· I'm going to use the LEDs under the trackball to indicate status (green is good, red is bad, flashing red is very bad sort of thing.)
Hank.
Do NOT try this at home!· (Well...ok...go ahead.)
http://www.dna.ca/photos/MOV03720.MPG
That's a can of cryo spray.
Here's the result:
The unfortunate one got·down as far as - 46.8750 which is pretty darned cold.
Hank.
·
http://www.dna.ca/photos/MOV03721.MPG
They went from this:
to this:
So...I guess I can say that it is working now.· I'm giddy with excitement.· Or...it could be all the cryo spray in my little straw bale shed.
Hank.
·
LMAO,
I used a cube of ice to test my ds18b20. Did not go as low and as fast!
What I like about them is , they react really fast. from an ice cube to a hot coffee cup, was about 10 secs or so (not timed).
So, they are really sensitive to changes and fast too...
Good Video ...
Cheers
Yosh
I finally found the "sweet spot" with 1-Wire vis-a-vis PropBASIC. I've attached a "work" file that demonstrates how to read the serial # from a DS1822 and then send it back to read from that device. What you want to avoid is using more than one "big" PropBASIC command in a program as each is converted to assembly inline and consumes precious cog space. My demo wraps all of the 1-Wire commands into subs/funcs so they only compile once, and I've added OW_READ_SN and OW_WRITE_SN to read and write serial numbers from the buss.
Now that this seems to be working well I will move the 1-Wire routines to a library.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Althouh unzipped ow_work_v2.zip, I cannot find delays.lib/pst_serial.lib inside ow_work_v2's folder on BST-window.
ow_work_v2.pbas's compile-information is no error.
Is this abnormal?
caskaz
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
I copied delays.lib/pst_serial.lib/ow_work_v2.pbas to PropBasic-bst-00.00.99-67's folder. (there is PropBasic-bst.exe inside folder)
Opened BST-window.
I opend PropBasic-bst-00.00.99-67's folder, but I cannot see lib-file on list.
caskaz
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
It's not. I'll add *.lib to the *.pbas settings for the next release.
<edit> If you select the (*.*) option in the file selector it should work anyway right now.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Are you suggesting coconuts migrate?"
Post Edited (BradC) : 5/29/2010 1:09:12 AM GMT