Basic stamp can do 50,000 baud better than 38,400
metron9
Posts: 1,100
I was working on my little tiny2313 PWM project using one of the majic crystal numbers 14.7456MHZ so i could use 38.4khz serial baud rate with the basic stamp. Having problems with it I looked into it further. I guess the serial baud rate is based on a 1MHZ clock on the BS2 and 9600 baud has a 0.2% error·percentage and 38.4K has an -18.6% error percentage. I switched to a 20Mhz crystal and put in 50kbs baud rate on the tiny2313 and set the BS2 baud rate to 0 as the formula (1,000,000/baud)-20 is zero. It runs great with no errors now.
Here is a video of 4 PWM LED's using the following BS2 code conected to the tiny2313 chip using serial output at 50kbs. Frequency is 39khz on the PWM.
·http://www.acousticlights.com/pwmtiny2313.html
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
Here is a video of 4 PWM LED's using the following BS2 code conected to the tiny2313 chip using serial output at 50kbs. Frequency is 39khz on the PWM.
·http://www.acousticlights.com/pwmtiny2313.html
' {$STAMP BS2} ' {$PBASIC 2.5} ' {$PORT COM1} baud CON 0 i VAR Byte j VAR Byte k VAR Byte l VAR Byte reset: i=0 j=0 k=0 l=0 HIGH 0 LOW 0 PAUSE 1 FOR i=1 TO 254 SEROUT 0, baud, [noparse][[/noparse]i,j,k,l] NEXT GOTO start main: FOR i=1 TO 254 l=l-1 SEROUT 0, baud, [noparse][[/noparse]i,j,k,l] NEXT start: FOR j=1 TO 254 i=i-1 SEROUT 0, baud, [noparse][[/noparse]i,j,k,l] NEXT FOR k=1 TO 254 j=j-1 SEROUT 0, baud, [noparse][[/noparse]i,j,k,l] NEXT FOR l=1 TO 254 k=k-1 SEROUT 0, baud, [noparse][[/noparse]i,j,k,l] NEXT FOR l=254 TO 1 SEROUT 0, baud, [noparse][[/noparse]i,j,k,l] NEXT FOR i=1 TO 255 SEROUT 0,baud,[noparse][[/noparse]i,0,0,0] NEXT FOR i=255 TO 1 SEROUT 0,baud,[noparse][[/noparse]i,0,0,0] NEXT FOR i=1 TO 255 SEROUT 0,baud,[noparse][[/noparse]0,i,0,0] NEXT FOR i=255 TO 1 SEROUT 0,baud,[noparse][[/noparse]0,i,0,0] NEXT FOR i=1 TO 255 SEROUT 0,baud,[noparse][[/noparse]0,0,i,0] NEXT FOR i=255 TO 1 SEROUT 0,baud,[noparse][[/noparse]0,0,i,0] NEXT FOR i=1 TO 255 SEROUT 0,baud,[noparse][[/noparse]0,0,0,i] NEXT FOR i=255 TO 1 SEROUT 0,baud,[noparse][[/noparse]0,0,0,i] NEXT FOR i=1 TO 255 SEROUT 0,baud,[noparse][[/noparse]i,i,i,i] NEXT FOR i=255 TO 1 SEROUT 0,baud,[noparse][[/noparse]i,i,i,i] NEXT FOR i=10 TO 250 STEP 10 SEROUT 0,baud,[noparse][[/noparse]i,i,i,i] PAUSE 30 SEROUT 0,baud,[noparse][[/noparse]0,0,0,0] PAUSE 30 NEXT FOR i=250 TO 0 STEP 10 SEROUT 0,baud,[noparse][[/noparse]i,i,i,i] PAUSE 30 SEROUT 0,baud,[noparse][[/noparse]0,0,0,0] PAUSE 30 NEXT GOTO reset
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
Comments
Way cool!
Why are your videos so much better than mine?
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The video like this one is made using a product called camtasia studio it also makes swf file format video for streaming web download.
http://www.acousticlights.com/vnq660.html
This is the output from a vnq660 quad high side mosfet that can output 6 amps per channel. The PWM Frequency is about 600hz because the turn on and turn off time of this quad fet is 70 and 140 uS max. However, this is a reason not to use this fet for a PWM application with high current because the fet would be operating in its in between on and off state and waste a lot of power (heat up). I originally was going to use this for an LED dimmer but I did not read the on off times. Makes a nice high side switch though.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
My setup is not TOO diffferent from yours, other than I am simply using the raw mpg output of the 5 megapixel Sony Mavica.
I have Dreamweaver Professional, but do not know how to really use it. To my knowledge, I do not have Macromedia Flash Professional.
I discovered that my REAL problem with my movie quality was that I had it set to play at full screen. DUH!
I like your PWM LED display!
Thanks for the advice.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.