Exact match. Not showing close matches.
PICList
Thread
'[SX] clock speed and r/c circuit (RCTIME)'
2009\02\19@183518
by
mspeedien/a
|
|
I wrote some code that runs perfectly on the Basic Stamp. Because SX chips are so much cheaper, I'm converting the code to SX/B. My code has some RCTIME functions that don't seem to be working on the SX28. Could it be the different clock speeds of the chips? Also, a side question, is there an easy (or not-so-easy) way to see debug statements using SX28?
Thanks for the help!
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=329983
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
|
|
Time to hit the manual and the SX/B help file :-)
- RCTIME should work nearly the same as on the Stamp, but read the manual -- and check your resolution. Make sure you have an accurate clock source (either an external resonator or the SX-Key).
- there is no "debug" on the SX like there is on the Stamp. You can "WATCH" variables which lets you see their values on your PC while you are running a program. Read up on debugging -- there is a lot you can do, but it's not like the Stamp.
- you can program your SX to send ASCII serial data a la "DEBUG" on the Stamp. You would need level-shifter circuitry to convert the TTL serial data from the SX to RS-232 for your PC, but if you just need to see variable values (like the results of an RCTIME) then using the regular debug features would probably be simplest.
- can post your circuit and code? Otherwise it's just guesswork from this end.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=329983#m330007
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
|
|
Here's an explanation of the following code: I ran the RCTime function 100 times, and timed the counter loop. The entire process took 64 seconds. Subtracting (100*20ms pause=2s), the total time for the 100 RCTime routines took 62 seconds. This is 620ms per RCTime function. This makes no sense to me as running the command using the BASIC Stamp takes about 2ms.
So, here's the code... I'm attaching a picture of the SX proto board (ignore the red wires, they are my home-made Vin). I have two resisters in series coming from pin rb.7 totalling approximately 220-ohms, then a 0.1uF cap and 15k-ohm in parallel to ground.
' =========================================================================
'
' File...... test RC-Time Circuit 2009-04-25.sxb
' Purpose... test rc-time
' Author....
' E-mail....
' Started...
' Updated... 2009-
'
' =========================================================================
' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------
' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
PhotoR PIN RB.7 ' RC-Time from photo-resistor
' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------
' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------
T VAR Word
' -------------------------------------------------------------------------
INTERRUPT
' -------------------------------------------------------------------------
ISR_Start:
' ISR code here
ISR_Exit:
RETURNINT ' {cycles}
' =========================================================================
PROGRAM Start
' =========================================================================
Pgm_ID:
DATA "SX/B Template", 0
' -------------------------------------------------------------------------
' Subroutines / Jump Table
' -------------------------------------------------------------------------
' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------
Start:
' initialization code here
Main:
' main code here
COUNTER = 0
high ra.0 do while counter < 100
HIGH PhotoR
pause 20
PULSIN PhotoR, 1, T
counter = counter + 1
loop low ra.0 do
loop
GOTO Main
' -------------------------------------------------------------------------
' Page 1 Code
' -------------------------------------------------------------------------
'Page_1:
' ADDRESS $200
'P1_Start:
' GOTO P1_Start ' error if Pg0 overruns Pg1
' -------------------------------------------------------------------------
' Page 2 Code
' -------------------------------------------------------------------------
'Page_2:
' ADDRESS $400
'P2_Start:
' GOTO P2_Start ' error if Pg1 overruns Pg2
' -------------------------------------------------------------------------
' Page 3 Code
' -------------------------------------------------------------------------
'Page_3:
' ADDRESS $600
'P3_Start:
' GOTO P3_Start ' error if Pg3 overruns Pg4
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=329983#m347010
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
|
|
Your posted program doesn't even have a RCTIME command in it ????
Did you mean PULSIN ???
PULSIN does have different timing in SX/B than on the Basic Stamp.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=329983#m347039
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2009
, 2010 only
- Today
- New search...