what to connect serial communication to to test it/
realolman
Posts: 65
I have downloaded chip gracey's full duplex serial for· the propeller from the object exchange...
I'm not sure what to do with it. there seems to be both spin and assy language.··
To what can you connect it· to try it out?· Is there some documentation somewhere?
thanks
Post Edited (realolman) : 1/9/2009 9:05:14 PM GMT
I'm not sure what to do with it. there seems to be both spin and assy language.··
To what can you connect it· to try it out?· Is there some documentation somewhere?
thanks
Post Edited (realolman) : 1/9/2009 9:05:14 PM GMT
Comments
Have you worked your way through chapter 3 of the Propeller manual yet? If not, you should go there, hook up some LEDs to your Prop, and use the exercises in that chapter to familiarize yourself with the Propeller programming concepts. It'll clear up just about everything.
Edit: ditto everyone else on the "how about a subject line?". All forum posts should have descriptive subjects.
Post Edited (sylvie369) : 1/9/2009 5:42:42 PM GMT
You could try it out just by connecting your Rx pin to your Tx pin as a loop back. Then send out bytes and receive them back as a test using the rx() and tx() functions
Do you have an application in mind?
P.S. Best add a subject to your thread.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
There's no disgrace in being dumb, but it is often unhandy.
Anyhoo...··· What I would eventually probably like to communicate with is a Visual Basic application, but for now, just to try to learn and understand this code, could you communicate with Hyper terminal or something like that?
I know what to do with serial comms in general, but I don't know what to do with this particular code in the propeller in order to try it out.
I guess I don't understand the concept of the "loop back"
There are all sorts of examples people have posted (and made suggestions) for a Stamp to communicate with VB. Exactly the same thing applies to using a Propeller for the same purpose. You can even use the BS2 Compatibility Library from the Object Exchange to supply the same sort of functionality. FullDuplexSerial just provides buffered serial I/O which neither the Stamp itself nor the BS2 Compatibility Library provides.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
www.parallax.com/ProductInfo/Microcontrollers/PropellerGeneralInformation/PropellerDownloads/tabid/442/Default.aspx
It's useful to have what amounts to a (Stamp-style) Debug terminal for the Propeller, of course, and the PST uses the FullDuplexSerial object.
·· Hi, I was at the same point as you 2 days ago - i just started using this excellent serial communication object by Chip Gracey.
···Try the following (nothing special just 10 x's followed by a \r\n), my setup is using a javax.comm serial client on the host - but you should see serial output using any terminal program that matches the baud rate.
· 1. open a new propeller tool IDE
··2. type in a new spin program like the quickstart code below
· 3. put·Chip Gracey's FullDuplexSerial.spin into the same directory as your spin driver program
· 4. drag FullDuplexSerial.spin into your propeller tool IDE - just to view it
· 5. download your spin program by selecting its' tab and hitting F10 or F11
· 6. open a terminal or comm host program to see the x
{ quickstart spin driver for FullDuplexSerial.spin
}
VAR
OBJ
· SER··· : "FullDuplexSerial"·
DAT
···
CON
· ' spin stamp·
'· _CLKMODE = XTAL1 + PLL4X···· ' clock speed to low = 1X=10Mhz
'· _XINFREQ = 10_000_000
· ' non-spin stamp
· _CLKMODE = XTAL1 + PLL8X···· ' clock speed to high = 80Mhz
· _XINFREQ = 5_000_000
·
PUB Main
·ser.start(31,30,0,38400)
· dira[noparse][[/noparse]15] := 1 ' output port to also flash an LED for example
· repeat
·· repeat 10
··· outa[noparse][[/noparse]15] := 0
··· waitcnt(10_000 + cnt)
··· ser.tx("x")
··· outa[noparse][[/noparse]15] := 1
··· waitcnt(10_000 + cnt)
·· ser.tx(13)
·· ser.tx(10)···
··
· thank you
· /michael
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439
cruising][noparse][[/noparse]url=http://www.bluemagic.biz]cruising[noparse][[/noparse]/url][/url]
This is a [noparse][[/noparse]b]bold[noparse][[/noparse]/b] test.
I have a·USB Propeller education board.· I have gone through·chapter three of the ·manual, and turned the LED s on and off and what not...·but I don't see anything about this or serial communication.
It appears to me that the Tx and Rx of the usb plug is hooked to P30 and 31 of the propeller.
I have downloaded the program to the propeller... now what?
Am I supposed to be using Full Duplex Serial as an·object that I call·from from something that I write or what?
How do I input what I want to transmit, transmit something, and how do I know I received it?
Should I be able to use Hyper terminal for Michael's program.. what com port?· ·what is the baud rate? start bits? stop bits? ·handshaking?
Like I said... sorry to be so dense, but I am just a noob with the propeller.· If there is some written literature explaining this I will be glad to read it, and not bug you folks.
Post Edited (realolman) : 1/10/2009 6:58:21 PM GMT
Even without a hyperterminal host connected you will see (red) led output for about 10 second from the propeller usb port when serial output is being sent.
See the following post for a photo of what you will see.
To get the port for hyperterminal hit F7 in the propeller too to get the comm port to your propeller.
Use all defaults for eberything else except the baud rate (this value must match spin and on the pc.
If you look at the driver spin above you will see a declaration to SER - this is the reference to chips's object.
Test in stages, comment out all ser.* line and make sure you see led output first.
The loopback test above is also a good test.
Thank you
/michael
http://forums.parallax.com/forums/default.aspx?f=25&m=318912
Shouldn't I be seeing "x" 's...····from the line:···· ser.tx("x")
I'm getting a bunch of this:
·þ€þ€þ€þ€þ€þ€þ€þ怘€€þ€þ€þ€þ€þ€þ€þ€þ€þ€þ怘€€þ€þ€þ€þ€
þ€þ€þ€þ€þ€þ怘€€þ€þ€þ€þ€þ€...
Although it is definately Tx 'in
Again... thanks for helping.
EDIT: I had the wrong baud rate ...·· I'm getting rows of x's now.
I thought the line calling the ser.start(31,30,0,38400) set 38400 as the baudrate.... I'm not quite understanding the· CON block... seems to have 2 different clock speeds?
EDIT the EDIT.. I see now that one set makes the baud rate 38400 and the other makes it· 19200· also I used the PST... works nicer than hyperterminal ... all you have to do is pause it and com 5 is good to go with the propeller tool again.
Again, again ...· thanks for helping. I'll have to mess with this for a while.
Post Edited (realolman) : 1/10/2009 9:14:54 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439
My cruising website http://www.bluemagic.biz
Is this stuff correct?
·1. you can only send one byte at a time the way it is written
2. It has to be a string
3 What needs to be modified in order to send a larger transmission?·· Would you use something like·STRSIZE and a loop to send each character,· or can it be modified to send·something ·larger than a byte?
I have removed the loops from Michael's code and substituted· other byte size strings... which seems to work OK.···
·I also inserted more ser.tx( ) and that seems OK also
In full duplex serial,· why doesn't the lines after repeat until·need to be indented?
·I tried to indent it and it didn't work.
Post Edited (realolman) : 1/11/2009 2:04:29 PM GMT
(Postedit: use ser. instead of fdx.)
fdx.str(string("The quick brown fox", $0D))
fdx.tx("Y")
fdx.tx($41)
fdx.hex(data,8)
Repeat: If you indent the lines under the repeat until .... they will be executed which waiting for the repeat to be satisfied. Without indentation, the repeat will wait until the condition is valid before passing control to the next lines.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439
My cruising website http://www.bluemagic.biz
How does one know that the syntax you showed with the "tx.str(string("The quick brown fox", $0D))"
exists... where is this stuff documented?
again.... thanks
The syntax of the FullDuplexSerial object itself is documented in that object. The str method looks like this:
That tells you that you need to supply a pointer to the string that you want to transmit. You could either send a pointer to a string variable (whose value has been established elsewhere), or you could use the string directive to supply a pointer to a constant string of characters right there in your str code.
In general, you're going to want to know about the directives like string that are built into Spin, and you're going to want to become familiar with the methods in the various objects (like PUB str in the FullDuplexSerial object) that expand on Spin. Look at the rest of the methods in FullDuplexSerial - those are all additional things that Spin can do as long as you put a reference to the FullDuplexSerial object into your OBJ block.
Note: Cluso99 wrote "(Postedit: use ser. instead of fdx.)"
Actually, he'll need to use whatever label he used to include the FullDuplexSerial object up in his OBJ block. It's not "ser" or "fdx" necessarily: it's whatever you choose to call it. For example, if I have this:
then my program might have this later:
In that case, "Debug" refers to the FullDuplexSerial object. On the other hand, if in my OBJ block I said this:
then my program would have to say this:
Post Edited (sylvie369) : 1/11/2009 3:45:50 PM GMT
I have a lot to learn.
I don't know how to declare a string variable.
Post Edited (realolman) : 1/13/2009 10:15:09 PM GMT
in SPIN there are NO stringvariables.
You have to declare an array of bytes where each byte contains ONE character of the string.
This bytesequence needs a ZERO at the end. Zero-terminated strings
And then you have to use a POINTER to the ADRESS of the first element of this array.
You can get the ADRESS of any variable by using the Adress-Operator "@"
To make life a little bit easier you can use the Extended_FDSerial-object from the obex
This object uses FullDuplexSerial as a base and adds some useful methods.
This codesnippet is NOT a working demo it just shows the basic principle
It's up to you to make sure that your bytearray is BIG enough (long enough)
to load in the complete string
It's up to you to make sure that the string ALWAYS ends with a zero
otherwise commands like str(PointerToMyStr) will make crash your program
another way is to define variables in the DAT-section of the sourcecode
again a code-SNIPPET (=uncompleted demo)
best regards
Stefan