serial communication issue
stelath_shadow9
Posts: 23
So I took the advice about using an external crystal. But now that I am at this point I am stuck again. The prop manual doesn't seem to be working for me. but here is what I have so far
The crystal I am using is 16Mhz and plugged into pin 25 and 26.
The odd thing about this is when I type a letter into pin1 the prop outputs a weird character. However if I change the output from "char" to something like "k" I will be able to see the "k" being output. But for whatever reason, I cannot see the appropriate character when I use the "char" variable.
I Haved checked the input into pin1 to ensure it is actually the correct ascii character I am typing. So...any ideas?
' CON _clkmode = xtal2 +PLL4x 'no idea what this should be for 16Mhz crystal _xinfreq = 4_000_000 VAR byte char 'variable for incoming bytes OBJ bs2 : "bs2" pub start bs2.start(31,30) this PUB this repeat char:=bs2.serin_char(1,9600,1,8) 'serin a byte and make char variable the same as that byte bs2.serout_char (30,char,9600,1,8) 'output char that just came in
The crystal I am using is 16Mhz and plugged into pin 25 and 26.
The odd thing about this is when I type a letter into pin1 the prop outputs a weird character. However if I change the output from "char" to something like "k" I will be able to see the "k" being output. But for whatever reason, I cannot see the appropriate character when I use the "char" variable.
I Haved checked the input into pin1 to ensure it is actually the correct ascii character I am typing. So...any ideas?
Comments
10Mhz is the limit.
Most programs are wtitten to use a 5Mhz xtal and the PLL16X setting to get 80Mhz clocck.
Bean
I may very well be wrong here, but isn't the 10Mhz crystal limit for PLL use.
A 16Mhz crystal will just max out at 16Mhz, won't it?
I totally agree you can't use it to wind up to 80Mhz.
His code's first two lines need to be changed to this:
Now if configured like this the 16mhz prop will run slow as molasses
The 16mhz crystal prop could be used as a configurable clock SOURCE, if you have two props.
Configure the 16mhz clock to run obex object http://obex.parallax.com/object/242 (im not sure if this object will like 16mhz)
And have the object generate a 5mhz signal.
Then run the 5mhz signal output pin on prop1 to the XI of prop 2.
Configure prop2 as such. And now the second prop is running 80mhz.
And you wonder why they call me Clock Loop.
Perhaps it might be a good idea for you to do the examples that were downloaded with proptool. They will start you on your way. There are also examples of code usage etc here too. Also, look in the sticky thread at the top of these threads for more beginner info.
-Phil
Right? but when i use 8_000_000 it doesnt work. The characters out become all messed up.
When I do the 4_000_000 though, it works.
Thats why I was asking about what those constants are actually doing/ meaning.
-Phil
_clkmode = xtal1 +pll8x 'This tells the software to have the PLL multiply the incoming frequency (from the xtal pin) by 8
_xinfreq = 4_000_000 'This tells the software the frequency of the crystal connected to the xtal pins (4,000,000 Hz or 4MHz)
If you had a 4MHz crystal connected then the propeller clock would be 32,000,000 Hz, and the software would use that to calculate the timing for each bit of your serial data. Since you have an 8MHz crystal connected the actual propeller clock frequency is 64,000,000 Hz. This means the baud rate of the propeller and terminal are off by a factor of 2. Make both baud rates the same, make _xinfreq = 8_000_000, and recompile the program.
when you say off by a factor of 2 what are you referring to. In the program the baud rate is set to 9600 and on my terminal it is set to 9600. so I dont understand what is off by 2.
Also, why is it that the code I posted above is allowing the characters to show up correctly when the _xinfreq is set to 4_000_000 instead of 8_000_000