function passing error
chris jones
Posts: 391
when i try to pas a function from another file i get an error (( expected end of line)) i am just tryting to test to see if a varable is geting placed into my varable.
CON _clkmode = xtal1 + pll16x ' use crystal x 16 _xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz) LCD_PIN = 0 ' for Parallax 4x20 serial LCD on P0 LCD_BAUD = 19_200 LCD_LINES = 4 OBJ lcd : "debug_lcd" rf : "RF_Units" PUB main | idx if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES) ' start lcd lcd.cursor(0) ' cursor off lcd.backLight(true) ' backlight on (if available) lcd.custom(0, @Bullet) ' create custom character 0 lcd.cls ' clear the lcd lcd.str(string(" WSN", 13)) lcd.putc(0) ' display custom bullet character lcd.str(string("Sensor", 13)) lcd.putc(0) lcd.str(string("Energy", 13)) lcd.putc(0) lcd.str(string("RXBit")) repeat repeat idx from 0 to 255 updateLcd(idx) waitcnt(clkfreq / 5 + cnt) ' pad with 1/5 sec repeat idx from -255 to 0 updatelcd(idx) waitcnt(clkfreq / 5 + cnt) PRI updateLcd(value) lcd.gotoxy(12, 1) rf.start(string(myStr, 8)) ' print right-justified decimal value DAT Bullet byte $00, $04, $0E, $1F, $0E, $04, $00, $00
Comments
-Phil
Where is myStr? Perhaps "value" should be called "myStr"?
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster.
Post Edited (W9GFO) : 10/31/2009 6:23:21 AM GMT
so please archive your project and use the "Post Reply" and the Attachement Manager button
to provide your COMPLETE source-code
Stefan
woo wow lot's of spinfiles glued together. Pretty normal in complex projects.
But as you are asking for very basic things you should start with much less complex things
Don't get me wrong - I'm willing to help. But this forum is not a replacement for your homework.
It's not called the I write postings for everything you can read in the manual or the PE-kit-lab.
From your code I can see that you haven't understand what objects are. Maybe you can glue them together
but the compiler reports compile-errors.
I will give you an answer if
1) you post a detailed description of what your project should do use normal words NO pseudo-code
2) you post a suggestion what MIGHT be the bug.
It doesn't matter if your suggestion is right or wrong just take a look onto the picture I posted above
and then post a suggestion. I will refuse to help until you posted these two points.
Anybody else can post whatever he wants as this is a free forum. At this point I have conditions to go on helping
best regards
Stefan
but i will have a detailed reply with what i need my project to do, Also a reason i might be geting the bugs.
i have a few questions for you....
1. is there a way i can get a debug screen like in the bs2 chip
2. is it bad to have a lot of objects or do i just have the concept of objects wrong
3. is there other books i can read that will help e with the propeller chip i have the manual and the ref sheet and all the smaple programs, but it will be great if i had a debug screen to see what my vartables are doing or something displayed to the screen.
Also thanks or your help and suggestions
best regards
CJ
I didn't meant homework for school. I mean that kind of homework that you can read in the manual or at least the small piece in the picture I posted above
where I already did the work to point on the page wich is important and cutted out the one sentence that is important.
what do you guess what the error might be. Come on ! Post a quick guessing !
What will be helpful additional are two things:
1) the PE Kit Lab wich can be found here
If you have read other threads you might already found this there.
2) A style of writing postings that makes clear what you have already done on YOUR OWN (homework)
example: I read the table of contents of the prop-manual but I don't know wich item is related to my problem with the function call
can somebody point me to where I will find information about calling functions ?
This is a pollite style that will make other forum-member go beyond that, what you are asking for as you show that you are willing to do
what is your "homework" = things you can do on your own.
That's a complete different style than just do a quick ask
my program does not work - what's wrong ?
(and between the lines this could be interpreted as "hurry up posting a working program for me !!! avanti presto avanti !!)
best regards
Stefan
Post Edited (StefanL38) : 10/31/2009 7:16:26 PM GMT
the method "str" expects ONE long.
umh ? How can ONE long make the program send a complete string ??
The long holds a very certain value. The value of the long is a RAM-adress.
Imagine a big house with a lot of chambers. You have a butler. You have papers to write commands on them
and pass the paper to the butler.
The papers are really small so you can write just one number on it.
You can make the butler shout just this number
But there is a second variant.
You can make the butler walk through the house to the chamber with the number on the paper.
Inside the chamber the butler will find a BIG piece of paper with a lot of characters on it and then this is what he should shout
That's a picture how strings are realized in SPIN. Somewhere in the RAM you store a bytesequence with all the characters.
The place in RAM has a certain adress. Now you pass the RAM-adress to the method str
Then the method str takes the bytes stored in the RAM beginning at the given adress.
OK and how does the method str now when to stop reading bytes from RAM ?
The bytesequence ends with value zero. Whenever method str cames across value zero it stops
This is called zero-terminated strings (it is the same as when programming in C)
string("abcdef")) is transformed by the compiler to
a) a bytesequence a,b,c,d,e,f,zero and it passes the adress of this bytesequence to the method str
b) bytesequence ends with an ADDITIONAL zero
You tried to pass the bytearray-variable mystring to the "method" string
but string accepts only characters in doublehyphens example string("hi Paul!")
it does NOT accepts variables like string(MyVariable)
your method
has NO parameters but you call the method with a parameter
It seems that you wrote a lot of lines of code at once
and then started testing it. My recommendation is to divide your code
in small pieces. Add a small part and immediatly test it. If it works properly
add the next SMALL part and test again.
This way you will succed faster, Because the area to search through for bugs is always small.
It's a mystery to believe that writing big pieces of code save time.
It eats up more and more time when the untested but nested code gets longer and longer
So what is the most important part of your prgram ?
Start with this part and add a small piece. If this does not work come here into the forum
posting a concrete question
best regards
Stefan
can you tell me now i can get a debug window on my computer to see whats going where. I have removed the object i created RF_Units i found ouyt i was using this wrong, but now i am stuck i dont know how to tell the reciver to take in the string that i am passing.
ALSO you said i had errors in my code where are you seeing the errors is there a debug error screen
Post Edited (chris jones) : 11/2/2009 9:47:55 PM GMT