There was a bug discovered in 00.00.98 with WDATA and LDATA. This has been fixed and version 00.00.98a has been posted.
Also a major improvement in the LOAD command now allows libraries to be loaded.
These libraries contain subroutines and tasks that support your programs. This is pretty close to objects in spin.
I have attached a VGA library file and here is a simple demo program that uses it. Notice how nice and clean it is.
NOTICE: You·need to be using 00.00.98a for·libraries to work.
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
LOAD "VGA.lib"
x VAR LONG
y VAR LONG
color VAR LONG
PROGRAM Start
Start:
for color = 0 to 3
for y = 0 to 239
for x = 0 to 319
VGA_Plot x, y, color
next
next
next
goto Start
end
I will update the demo programs to use libraries as soon as I can.
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]
johhny mac said...
You should be able to put the serial number into a DATA table and then iterate through it.
Johnny,
Thank you for the suggestion.· I have tried the code you sent me and unfortunately it doesn't work.· Now, in your defence, I'm not 100% sure that I have the correct Serial Numbers for the DS18B20s.· I'm assuming (with the usual caveat about doing that) that the Serial Numbers are correct because the SearchROM program finds the correct Family Code.
By way of a test of splitting the command into pieces I've taken the DS18B20 demo program included in the Demos.zip file and run it like this:
OWRESET DQPin
OWWRITE DQPin, $44CC\16 ' SkipROM($CC) & Convert($44)
PAUSE 750 ' Wait for conversion
' Read temperature value
OWRESET DQPin
OWWRITE DQPin, $BECC\16
OWREAD DQPin, value\16
which works, and like this:
OWRESET DQPin
OWWRITE DQPin, $44\8 ' SkipROM($CC)
OWWRITE DQPin, $CC\8 ' Convert($44)
PAUSE 750 ' Wait for conversion
' Read temperature value
OWRESET DQPin
OWWRITE DQPin, $BECC\16
OWREAD DQPin, value\16
which doesn't work.· Is it possible that this is a timing issue or that the OWWrite command is doing something unexpected?· I'm leaning towards a timing issue since in one instance it works and in the other it doesn't.
In the two cases when it works the 16 bits that come back are:
0000000110000000
(it is warm under the lights on my desk) and when it doesn't I get back:
1111111111111111
If doing this worked but my effort with the serial numbers failed I would be throwing myself on my sword and saying that the SearchROM code probably wasn't working.· Since this change doesn't work I have no idea whether what I am trying with the serial numbers is valid or not.· If we can figure out why the change to the Demo program doesn't work and get it working then we will be able to figure out whether the serial number thing is working or not.
Thank you for any and all suggestions.
I just wanted to add here that I am very impressed with PropBASIC and I'm really looking forward to getting deeper into it.· As I've said I've got more than 30 years of experience programming in so many assembly languages, BASICs, and others that I can't count them all.· I'm writing real world code and look forward to seeing the language develop.· There are a few things that I would love to see added and some extensions of functionality that I think would greatly improve the utility of the language that I will·suggest as you get to know me better.
One of my partners is looking at developing drivers for the Kyocera KCS057QV1AJ-G32 LCD with touch panel and another is working on a solar panel heating controller.
Thus far, the only real work I've done with 1-Wire has been in Spin; the suggestion was a port from a demo that works (see attached).·
You may be on to something vis-a-vis timing; I'll have to look.· In my Spin program, I use my own 1-Wire driver which uses timing values that come straight from Dallas Semiconductor engineers.· I got these numbers when working for Parallax and living in Dallas, TX.· There was an odd issue with the BS2p series and a particular iButton. When we looked into it we found the problem was that the BS2p's timing was too tight.· Dallas gave us a timing spec for 1-Wire that they said would work well under even the worst conditions -- seemed to hold true.
For fun, I may just port my assembly routines to PropBASIC since 1) I have them, and 2) I fold complex commands (like OWRESET) into subroutines and functions, anyway.
I've attached a well-behaved Spin program and my 1-Wire object for your reference.· I've started porting it to PropBASIC.· Once it's working, I will share.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Many thanks.· My partners who are working on the solar heating controller (well...in reality...they are doing the hardware and I'm writing the foundation of the code that they will then use to continue) are going to stick the scope on the 1-wire bus and we'll compare the timing of the two versions of the demo program to see what the difference is.
I've got another question...well...a request really.· I have never looked at Spin before.· I've downloaded your essential Spin 1-wire routines but I don't know where to begin.
The biggest thing that I would like to be able to do is send the commands:
$55280000027CB1D54644
$55280000027CB1D546BE
and read back the 16 bit response.
Can you, or anyone, tell me how to make your essential 1-wire Spin program do that?
If someone kicks me in the right direction I can then fiddle with the order of the bytes to see if I can make it read the DS18B20 from the middle of the pack.
Give the attached program a try -- it just reads back the 1-Wire serial # and displays it using my 1-Wire object. Note that you can only have one device on the buss.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
As an exercise I updated my DS1822 demo to read the serial number into a DAT table and then uses that to access the device (see the readtca() method; it uses the MATCH_ROM command and sends the serial #). Perhaps this will help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Below is a test program, which does not compile. The error is: "SDcard - error at (61,34) symbol not defined! I used
your example, but for me it is not working. What am I missing?
Ray
' SDcard
'
device p8x32a, xtal1, pll16x
xin 5_000_000
LOAD "tools.lib"
program Start
Start:
Main:
do
Debug_RX
if rxResult = 13 then exit
loop
end
'tools.lib
'
DebugBaud con "T57600"
DebugRXPin pin 31 low
rxResult var long
Debug_RX sub 0
'{$CODE}
'{$IFUSED Debug_RX}
sub Debug_RX
serin DebugRXPin, DebugBaud, rxResult
endsub
'{$ENDIF}
Not sure what the problem is because it compiles for me (version 0.98a); that said,·I find three things that you may want to consider:
1) Define your pins and baud rate·in the main program instead of the library; this makes the library more flexible
2) Don't define a serial input pin as LOW (which makes it an output); SERIN fixes this, but you still shouldn't do it
3) SERIN returns a value, so your shell should, too -- make it a function that can return the value to any variable (see RX_BYTE)
See attached.·Please try it before modifying.
[noparse][[/noparse] Edit ] Update the files -- see below
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
After further testing, I have found that if you try to load two libraries and the first one has TASKs, it will fail.
The reason is that ALL the subroutines that need to be in the main code have to be processed before the first TASK.
I'm working on it...
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]
After I checked a little further, I found the problem, working with the wrong version number, again. Hopefully, it is fixed this time, making sure that I have the right version number, in the correct folder.
The reason I put everything into the lib file was because I was trying to narrow down the bug that I thought I had. My thinking now is to create a lib file that has all of the SUBs that are used frequently like serial, ms_delay, and others. Then maybe have subject specific lib files like VGA, SD, and others.
OK Bean, this new lib file stuff gives me one less reason to consider C, and Spin. Keep up the good work, PropBASIC is turning into a very useful compiler.
I found a bug in my serial.lib file with TX_RPT (repeats a character).· While I was in there I added a bunch of serial input routines:
RX_STR for generic strings (terminate with CR) -- allows for backspace RX_BIN for binary strings RX_HEX for hexadecimal strings RX_DEC for decimal strings (1st char can be "-" for negative)
These routines are suppported with
UCASE to convert alpha to uppercase MULT_10 to multiply a value by 10 (less code than *)
If you find any problems, please let me know.· The demo is updated to accept a string (your name) and a decimal number (your age).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
I am trying to work the SIRCS code into a .lib file, I am getting an error at(178,34)Symbol not defined! I am not sure if this is a bug or it is my
programming style that is at fault. When I remove the ' pWidth = Get_IR_Pulse' line of code, then it compiles OK. I am not sure why it is not
recognizing 'Get_IR_Pulse'? The reason the rest of the code is not there is because I am in the debugging mode.
Ray
'Rbase.pbas
'****************************
device p8x32a, xtal1, pll16x
xin 5_000_000
'****************************
LOAD "tools.lib"
'--------------
' Constants
'--------------
'--------------
' I/O Pins
'--------------
IRpin pin 4 input
LED1 pin 0 output
'--------------
' Shared (hub) Variables (Byte, Word, Long)
'--------------
'--------------
' Shared (hub) Data (DATA,WDATA,LDATA,FILE)
'--------------
'--------------
' TASK Definitions
'--------------
'--------------
' Cog Variables (long only)
'--------------
keyIn var long
'---------------------
' SUB/FUNC Definitions
'---------------------
'processKeys sub 0
TestLED sub 0
'*************
PROGRAM Start
'*************
Start:
Main:
high LED1
Delay_MS 1000
low LED1
Do
processKeys
loop
end
'*****************************************************************************
'--------------
' SUB/FUNC Code
'--------------
'sub processKeys
' keyIn = Get_SIRCS
'endsub
'==============
sub TestLED
high LED1
Delay_MS 1000
low LED1
endsub
'==============
'tools.lib
'
irCode var long
pWidth var long
irBits var long
Delay_MS sub 1
Get_IR_Pulse FUNC 0
Get_SIRCS FUNC 0
processKeys sub 0
'{$CODE}
'==============
'{$IFUSED Delay_MS}
sub Delay_MS
pause __param1
endsub
'{$ENDIF}
'==============
'{$IFUSED Get_IR_Pulse}
FUNC Get_IR_Pulse
pulsin IRpin, 0, __param1
return __param1
ENDFUNC
'{$ENDIF}
'{$IFUSED Get_SIRCS}
FUNC Get_SIRCS
do
pWidth = Get_IR_Pulse 'This is the problem line
loop until pWidth > 2160
return irCode
ENDFUNC
'{$ENDIF}
'{$IFUSED processKeys}
SUB processKeys
keyIn = Get_SIRCS
ENDSUB
'{$ENDIF}
@Gerry, I just tried your suggestion, and it still did not compile. I have the latest version of PropBASIC, .98a. So, if it compiles on your setup, and you have the same version, something is weird. The other curiosity is, why would changing the location of the FUNCs make a difference? If that is the case, then it makes the .lib thing a little less useful, because then you have to have FUNCs in a special order?
When working with a single-pass compiler like PropBASIC, the order in which subs and funcs appear is critical -- especially when invoking $IFUSED to remove unused subs and funcs.· As Bean points out, if SUB_A calls SUB_B, then SUB_B must appear after SUB_A when $IFUSED is in place.
I adapted my latest PropBASIC SIRCS code to a library.· As my code is a single, PASM function, there are no dependecy issues (other than the system set for 80MHz) and the code returns the key and the number of bits in the key so you can distinguish between DVD codes and TV codes.· I also changed it so you can (in fact, you must) pass the pin # to the function; since the function runs inline (i.e., not in a background cog) you could use the same function with multiple IR sensors.
The demo shows how to use the sircs80.lib file and GET_SIRCS function.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Thanks guys, I will have to look at the JonnyMac SIRCS80.lib, and see how it's coded. I made the mistake of assuming that if I took the pieces (FUNCs & SUBs) out of a working program, in the same order, and placed them in a .lib file, there would be no problems. Learn something new everyday; at some point I will be at a coding place where I will not have to ask so many questions.
For the most part, you can, and I've done that with my demos of late. If you start adding $IFUSED where it wasn't before you may have to look carefully for dependecy issues. In short, it's a good habit to put called subs/funcs lower in your listing than the calling sub/func, that way $IFUSED won't bite you.
In your program PROCESS_KEYS calls GET_SIRCS (in tools.lib) and yet appears after it in the listing -- this is the problem because you've got $IFUSED in place and GET_SIRCS is not called before PROCESS_KEYS, hence not compiled into the output.· You have the same order-of-appearance issue with GET_SIRCS and GET_IR_PULSE (should come after GET_SIRCS).
After seeing JonnyMac's FUNCs order visually, now I see what Gerry was talking about. I must have had a "senior moment" when I was reading the post. Now that the light has been turned on, everything seems to be working as expected. On to the next hurdle ...
I am trying to read the raw data from a Ping sensor into the PST using __STRING() and I get no data showing in PST. The program compiles and runs. I have attached the code.
__STRING doesn't do string conversion, STR does. __STRING is used with a pointer (to the string) so that you can use strings as parameters. Here's what you want to do:
vStr = STR value, 4
SEROUT TX, Baud, vStr
... where vStr is an array of bytes in the HUB big enough to hold your anticipated string (+1 for the trailing zero).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Working on some new code last night on my laptop running XP, BST 19.3 and PropBASIC 98a I was unable to compile my code with the filename "Ping_Task". Recieved this type error for almost every line " Error: Expected unique symbol name or #" Because I ran into this problem some time ago I tried changing the file name to "Test" and it compiles fine. Any ideas why? It seems any variation of names 8 or more characters long causes the compiler errors.
Note: Both files compile just fine on my Vista 64bit box.
I have attached both files and screen shot of error.
Version 00.00.99 will be available as soon as BradC gets it converted.·IS AVAILABLE NOW!!!
I have fixed the I2CWRITE bug that Jonny Mac found.
I have fixed the crash that happens if you alias system variables and have a TASK that Yendor found.
I have fixed the LOAD command so that libraries can have TASKs. · Libraries must use the '{$CODE} and '{$TASKS} compiler directives to seperate header/code/tasks in the file. See the attached TV.lib and VGA.lib files attached.
Here is a little demo of the TV and VGA libraries:
' Generates all text characters
'
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
LOAD "TV.lib"
LOAD "VGA.lib"
temp VAR LONG
PROGRAM Start
Start:
FOR temp = 32 TO 126
TV_Char temp
VGA_Char temp
NEXT
END
NOTE: The above program requires version 00.00.99
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]
Bean, thanks for all your hard work producing this great compiler.
Would you put the 1-wire·routines on your list of things to look at?· I've tested the Spin program that Johnny Mac posted and it works to read then use the serial number of the 1-wire device.· I have not been able to find any conbination of commands, variables, and data that will make it work in PropBASIC.· It is possible that I just don't have enough experience with the language yet to recognize the problem in my own code.
Ideally, it would be great to be able to do either of the following:
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
SendID SUB 1 ' Parameter is a DATA label
PROGRAM Start
Start:
SendID ID1
END
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
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]
Comments
Also a major improvement in the LOAD command now allows libraries to be loaded.
These libraries contain subroutines and tasks that support your programs. This is pretty close to objects in spin.
I have attached a VGA library file and here is a simple demo program that uses it. Notice how nice and clean it is.
NOTICE: You·need to be using 00.00.98a for·libraries to work.
I will update the demo programs to use libraries as soon as I can.
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]
Thank you for the suggestion.· I have tried the code you sent me and unfortunately it doesn't work.· Now, in your defence, I'm not 100% sure that I have the correct Serial Numbers for the DS18B20s.· I'm assuming (with the usual caveat about doing that) that the Serial Numbers are correct because the SearchROM program finds the correct Family Code.
By way of a test of splitting the command into pieces I've taken the DS18B20 demo program included in the Demos.zip file and run it like this:
which works, and like this:
which works, and like this:
which doesn't work.· Is it possible that this is a timing issue or that the OWWrite command is doing something unexpected?· I'm leaning towards a timing issue since in one instance it works and in the other it doesn't.
In the two cases when it works the 16 bits that come back are:
0000000110000000
(it is warm under the lights on my desk) and when it doesn't I get back:
1111111111111111
If doing this worked but my effort with the serial numbers failed I would be throwing myself on my sword and saying that the SearchROM code probably wasn't working.· Since this change doesn't work I have no idea whether what I am trying with the serial numbers is valid or not.· If we can figure out why the change to the Demo program doesn't work and get it working then we will be able to figure out whether the serial number thing is working or not.
Thank you for any and all suggestions.
I just wanted to add here that I am very impressed with PropBASIC and I'm really looking forward to getting deeper into it.· As I've said I've got more than 30 years of experience programming in so many assembly languages, BASICs, and others that I can't count them all.· I'm writing real world code and look forward to seeing the language develop.· There are a few things that I would love to see added and some extensions of functionality that I think would greatly improve the utility of the language that I will·suggest as you get to know me better.
One of my partners is looking at developing drivers for the Kyocera KCS057QV1AJ-G32 LCD with touch panel and another is working on a solar panel heating controller.
Hank.
·
Thus far, the only real work I've done with 1-Wire has been in Spin; the suggestion was a port from a demo that works (see attached).·
You may be on to something vis-a-vis timing; I'll have to look.· In my Spin program, I use my own 1-Wire driver which uses timing values that come straight from Dallas Semiconductor engineers.· I got these numbers when working for Parallax and living in Dallas, TX.· There was an odd issue with the BS2p series and a particular iButton. When we looked into it we found the problem was that the BS2p's timing was too tight.· Dallas gave us a timing spec for 1-Wire that they said would work well under even the worst conditions -- seemed to hold true.
For fun, I may just port my assembly routines to PropBASIC since 1) I have them, and 2) I fold complex commands (like OWRESET) into subroutines and functions, anyway.
I've attached a well-behaved Spin program and my 1-Wire object for your reference.· I've started porting it to PropBASIC.· Once it's working, I will share.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Once we have those results I will share as well.
Hank.
I've got another question...well...a request really.· I have never looked at Spin before.· I've downloaded your essential Spin 1-wire routines but I don't know where to begin.
The biggest thing that I would like to be able to do is send the commands:
$55280000027CB1D54644
$55280000027CB1D546BE
and read back the 16 bit response.
Can you, or anyone, tell me how to make your essential 1-wire Spin program do that?
If someone kicks me in the right direction I can then fiddle with the order of the bytes to see if I can make it read the DS18B20 from the middle of the pack.
Thanks,
Hank.
·
Give the attached program a try -- it just reads back the 1-Wire serial # and displays it using my 1-Wire object. Note that you can only have one device on the buss.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
As an exercise I updated my DS1822 demo to read the serial number into a DAT table and then uses that to access the device (see the readtca() method; it uses the MATCH_ROM command and sends the serial #). Perhaps this will help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Hank.
1-Wire Serial Number Reader
·-- Good reset
·-- SN: 460000027CB1D528
So my program is reading the SNs properly.· That is step one down.
Now...on to step 2.
Hank.
PS.· DO "Thanks"·LOOP· H.
your example, but for me it is not working. What am I missing?
Ray
1) Define your pins and baud rate·in the main program instead of the library; this makes the library more flexible
2) Don't define a serial input pin as LOW (which makes it an output); SERIN fixes this, but you still shouldn't do it
3) SERIN returns a value, so your shell should, too -- make it a function that can return the value to any variable (see RX_BYTE)
See attached.· Please try it before modifying.
[noparse][[/noparse] Edit ] Update the files -- see below
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Post Edited (JonnyMac) : 5/22/2010 6:27:25 PM GMT
The reason is that ALL the subroutines that need to be in the main code have to be processed before the first TASK.
I'm working on it...
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]
The reason I put everything into the lib file was because I was trying to narrow down the bug that I thought I had. My thinking now is to create a lib file that has all of the SUBs that are used frequently like serial, ms_delay, and others. Then maybe have subject specific lib files like VGA, SD, and others.
OK Bean, this new lib file stuff gives me one less reason to consider C, and Spin. Keep up the good work, PropBASIC is turning into a very useful compiler.
Ray
RX_STR for generic strings (terminate with CR) -- allows for backspace
RX_BIN for binary strings
RX_HEX for hexadecimal strings
RX_DEC for decimal strings (1st char can be "-" for negative)
These routines are suppported with
UCASE to convert alpha to uppercase
MULT_10 to multiply a value by 10 (less code than *)
If you find any problems, please let me know.· The demo is updated to accept a string (your name) and a decimal number (your age).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
programming style that is at fault. When I remove the ' pWidth = Get_IR_Pulse' line of code, then it compiles OK. I am not sure why it is not
recognizing 'Get_IR_Pulse'? The reason the rest of the code is not there is because I am in the debugging mode.
Ray
If you·place the·Get_SIRCS function before the Get_IR_Pulse function in the tools.lib it compiles ok.
regards
Gerry
Ray
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]
Ray
I adapted my latest PropBASIC SIRCS code to a library.· As my code is a single, PASM function, there are no dependecy issues (other than the system set for 80MHz) and the code returns the key and the number of bits in the key so you can distinguish between DVD codes and TV codes.· I also changed it so you can (in fact, you must) pass the pin # to the function; since the function runs inline (i.e., not in a background cog) you could use the same function with multiple IR sensors.
The demo shows how to use the sircs80.lib file and GET_SIRCS function.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Ray
In your program PROCESS_KEYS calls GET_SIRCS (in tools.lib) and yet appears after it in the listing -- this is the problem because you've got $IFUSED in place and GET_SIRCS is not called before PROCESS_KEYS, hence not compiled into the output.· You have the same order-of-appearance issue with GET_SIRCS and GET_IR_PULSE (should come after GET_SIRCS).
The order in the listing should be:
PROCESS_KEYS· (which uses...)
GET_SIRCS (which uses...)
GET_IR_PULSE
You had them in the reverse order, so you may have missunderstood how $IFUSED works.
BTW... you could help others help you by attaching your listings so we don't have to copy-and-paste to run them in the compiler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Post Edited (JonnyMac) : 5/23/2010 3:20:12 PM GMT
Ray
I am trying to read the raw data from a Ping sensor into the PST using __STRING() and I get no data showing in PST. The program compiles and runs. I have attached the code.
Tony
... where vStr is an array of bytes in the HUB big enough to hold your anticipated string (+1 for the trailing zero).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
Thanks for the help. Works great. I misunderstood __STRING() as replacing STR
Still trying to learn.
Tony
Working on some new code last night on my laptop running XP, BST 19.3 and PropBASIC 98a I was unable to compile my code with the filename "Ping_Task". Recieved this type error for almost every line " Error: Expected unique symbol name or #" Because I ran into this problem some time ago I tried changing the file name to "Test" and it compiles fine. Any ideas why? It seems any variation of names 8 or more characters long causes the compiler errors.
Note: Both files compile just fine on my Vista 64bit box.
I have attached both files and screen shot of error.
thanks,
Tony
I have fixed the I2CWRITE bug that Jonny Mac found.
I have fixed the crash that happens if you alias system variables and have a TASK that Yendor found.
I have fixed the LOAD command so that libraries can have TASKs.
· Libraries must use the '{$CODE} and '{$TASKS} compiler directives to seperate header/code/tasks in the file. See the attached TV.lib and VGA.lib files attached.
Here is a little demo of the TV and VGA libraries:
NOTE: The above program requires version 00.00.99
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 12:04:59 AM GMT
Would you put the 1-wire·routines on your list of things to look at?· I've tested the Spin program that Johnny Mac posted and it works to read then use the serial number of the 1-wire device.· I have not been able to find any conbination of commands, variables, and data that will make it work in PropBASIC.· It is possible that I just don't have enough experience with the language yet to recognize the problem in my own code.
Ideally, it would be great to be able to do either of the following:
or:
This could also work but not be idea:
Thanks,
Hank.
·
Try something like:
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 11:14:04 AM GMT