Exact match. Not showing close matches.
PICList
Thread
'[SX] SEROUT and 12Bit ADC'
2005\10\25@002546
by
sumguy16n/a
|
|
I am working on a wireless ADC. I have completed the prototype using a BS2, now for the hard part: switching to the SX20. I've just started working the SEROUT command with SX/B and have succesfully sent data across a wireless network. I cannot however transmit variables, I can only transmit constants. Here is my code:
i var byte
TX_Byte sub 1
Start:pause 200 for i = 0 to 20
TX_Byte i
pause 20
next
goto Start
TX_Byte:
SEROUT ra.0, T19200, __PARAM1
return
Also, I'm using a 12bit ADC and I would like to possibly use a 16bit ADC, any advice as to transmitting a 12bit value when I'm dealing with an 8bit byte?
And lastly, is it possible to transmit at 19200Bps @ 4MHz? Right now I'm running at 50MHz which isn't necessary and is a waste of power.
Thanks for reading!
Adam
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\25@050330 by Jon Williamsn/a
|
|
The reason it doesn't work is that you're using one of SX/B's internal work variabled (__PARAM1) inside you subroutine. If you do a Ctrl-L and look at the listing you'll see that __PARAM1 is used as part of the code that generates SEROUT. Add a set of work variables that you can use to hold passed parameters for your program, then you can update your program like this (from the SEROUT example in the help file):
' Use: TXBYTE theByte {, repeats }
' -- first parameter is byte to transmit
' -- second (optional) parameter is number of times to send
TXBYTE:
temp1 = __PARAM1 ' char to send
IF __PARAMCNT = 1 THEN ' if no repeats specified
temp2 = 1 ' - set to 1
ELSE
temp2 = __PARAM2
ENDIF
DO WHILE temp2 > 0
SEROUT Sout, Baud, temp1 ' send the character
DEC temp2
LOOP
RETURN
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93132
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\25@052321 by Jon Williamsn/a
|
|
Another thought -- you should send printable ASCII characters to Hyperterminal; use "A" TO "Z" in your loop instead of 0 TO 20.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93133
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\26@200536 by sumguy16n/a
|
|
Alright I got the SX transmitting values that are not constants, but now I'm stuck on reading a 12Bit adc. I saw the code snippet in the SX/B Help, but it wasn't very detailed. I'm still confused how to handle a 12Bit input with 8Bit variables. Here is my code that I'm using, I just get a bunch of garbage in Hyperterminal and the PBASIC debugger:
DEVICE SX18, OSCHS1, TURBO, STACKX, OPTIONX
FREQ 4_000_000
PROGRAM Start
' Program Variables
i var byte
temp var byte
measure var byte
batt var byte config VAR byte
startB VAR config.0 ' Start bit for comm with ADC.
sglDif VAR config.1 ' Single-ended or differential mode.
oddSign VAR config.2 ' Channel selection.
msbf VAR config.3 ' Output 0s after data xfer complete.' Program Subroutines
TX_Byte sub 1
ADC_Read sub 0
' Program Pins
Sout var ra.0
CS var rb.0
CLK var rb.1
DIO_n var rb.2
' Program Constants
Baud CON "T19200"
'==== Program ====
Start:
' Output Line: @measurementBbatt
ADC_Read
TX_Byte "@"
TX_Byte measure
TX_Byte "B"
TX_Byte batt
pause 200
goto Start
'======================================
'==== Analog to Digital Subroutine ====
'======================================
ADC_Read:
config = config | %1011 ' Set all bits except oddSign.
LOW CS ' Activate the ADC.
LOW CS
SHIFTOUT DIO_n, Clk, LSBFIRST, config\4 ' send config bits
SHIFTIN DIO_n, Clk, MSBPOST, measure\4 ' get data (upper nibble)
SHIFTIN DIO_n, Clk, MSBPOST, batt\8 ' get data (lower byte)
HIGH CS
return
'===============================
'==== Serial Out Subroutine ====
'===============================
TX_Byte:
temp = __PARAM1
SEROUT Sout, Baud, temp
return
Thanks,
Adam
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93392
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
SX/B doesn't handle 12-bit values as single units; you may want to have a read through Al Williams' or Guenther Daubach's books as they both discuss working with values beyond 8-bits. If you can do it in assembly you can apply it to SX/B.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93396
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\26@205151 by sumguy16n/a
|
|
the LTC1298, I would appreciate the demo very much.
Adam
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93408
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\26@225731 by Jon Williamsn/a
|
|
Okay, this program works. Interestingly enough, I found a mention of the LTC1298 in the SX/B help file ... at the end of the section on SHIFTIN.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93437
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\26@235642 by sumguy16n/a
|
|
WOW! Talk about results, I can't thank you enough for the demo, it works flawlessly. I'm sure you hear this a lot, but Parallax keeps on surprising me with their customer service, keep up the good work and I'll keep buying.
Thanks again Jon,
Adam
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93444
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\10\27@083248 by Jon Williamsn/a
|
|
Glad it works for you -- now buy Parallax products as Christmas gifts for all of your friends and family; share the joy!
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m93495
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
Alright I have my project working on a bread board exactly how I want to and of course when I make the proto board version it all goes to hell. I have been able to transmit data over SEROUT so I know the problem lies with the ADC, I have been in the process of verifying my solder joint for the last three days so I feel that it is a software issue.
The output with the bread board version is something like: V0FFF%0000
Where the first character determines the measurement type, next the value of the meaurement on ch1 seperated by a % sign and then the last value of ch2 is displayed. With the proto board version I get: V,,,* with two blocks after the asterisk. I have read things about bit shifting, but I am not sure why this would come up from transferring from a bread board to a pc board.
I thought that this process would be a matter of switching pin assignments in the code, but I guess not...
Any ideas would be greatly appreciated,
Adam from Seattle
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m98530
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\11\29@101535 by PJMontyn/a
|
|
Adam,
On your proto board, what are you using for a clock for the SX? A resonator, a TTL clock, or the internal 4 MHz clock?
[list]Thanks,
PeterM[/list]
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m98614
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
2005\11\29@151225 by sumguy16n/a
|
|
Murata 4MHz xtal
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m98660
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
|
|
I have issues when using crystals with my SX's. I have not had the same problems when using the Murata resonators (4 or 50 MHz). I have also had good luck using TTL clocks.
I also find that the SX is really sensitve to the lead length between the SX and the clock source. Now when I do a PC layout, the first thing that goes on, and as close to the SX as I can get it, is the clock source.
Nate
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=93123#m98672
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- Today
- New search...