Shop OBEX P1 Docs P2 Docs Learn Events
Digest Number 1198 — Parallax Forums

Digest Number 1198

ArchiverArchiver Posts: 46,084
edited 2002-06-17 20:24 in General Discussion

Original Message
From: basicstamps@yahoogroups.com
To: basicstamps@yahoogroups.com
Sent: 1/05/02 11:48
Subject: [noparse][[/noparse]basicstamps] Digest Number 1198

To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.


There are 19 messages in this issue.

Topics in this digest:

1. Re: error correction in a wireless app
From: "moparjody" <jody.gallant@s...>
2. Pics Programing
From: Johann Cover <curruption@y...>
3. Re: LTC1298
From: "rhess_1" <rhess@a...>
4. Re: LTC1298
From: "rhess_1" <rhess@a...>
5. Connecting to C++
From: "manish_shrestha" <manish_shrestha@y...>
6. Re: Re: LTC1298
From: "norman doty" <normdoty@h...>
7. RE: Connecting to C++
From: "Al Williams" <alw@a...>
8. RE: Connecting to C++
From: Manish Shrestha <manish_shrestha@y...>
9. Introduction
From: "Robert McCown" <rmccown@w...>
10. RE: Connecting to C++
From: "Al Williams" <alw@a...>
11. Re: Circuit Simulation Software
From: azeasi@a...
12. Re: Re: LTC1298
From: Beau Schwabe <bschwabe@a...>
13. RE: Circuit Simulation Software
From: "Justin" <justin@j...>
14. Re: Circuit Simulation Software
From: "David Covick" <dac@w...>
15. Serin baud rate
From: Leroy Hall <leroy@f...>
16. Re: Serin baud rate
From: Beau Schwabe <bschwabe@a...>
17. Re: Serin baud rate
From: Beau Schwabe <bschwabe@a...>
18. RE: Circuit Simulation Software
From: "Justin" <justin@j...>
19. BCD for DS1307
From: "Ricky Konvicka" <ricky@m...>


________________________________________________________________________
________________________________________________________________________

Message: 1
Date: Wed, 01 May 2002 10:22:35 -0000
From: "moparjody" <jody.gallant@s...>
Subject: Re: error correction in a wireless app

One thing you missed was the fact that this is a 1 direction
communication. A dedicated transmitter and a dedicated receiver.
The only way to solve this might be to go with a transceiver set.

I just thought there might be another way to do this with code. I
know I am receiving the data. (at 100ft I have -85db of signal
strenght) and if I remove the sync. command it gets the data. Its
usually corrupting the sync. bit, so the data isn't getting through.

thanks
Jody

--- In basicstamps@y..., Jim Higgins <HigginsJ@s...> wrote:
> At 16:16 04/30/02, moparjody wrote:
> >Hi guys.
> >
> >I have a wireless application that we have successfully working up
> >to about 250ft reliably, and as much as 900ft hit and miss.
> >
> >We are using the Serin command with a Wait(sync) command to watch
> >for a specific sync. signal from the transmitter.
> >
> >Is there any better way to do this and have more reliable results?
> >The unit is a transmitter/receiver pair, so no handshaking is
> >possible.
> >
> >Is there a way to possibly bring any and all data in, and do
better
> >analysis or forward error correction to interpret the data?
> >
> >I know there is signal there, as we are monitoring with a spectrum
> >analyzer, and if I remove the wait(sync) portion it receives the
> >data, but its usually somewhat corrupt.
> >
> >Any ideas welcome.
> >
> >Thanks in advance
> >Jody
>
> You didn't mention the baud rate you're using. Lower baud rate
may improve
> reliability.
>
> Also, if a bit of cost is no object, you can use a pair of Packet
Terminal
> Node Controllers (TNCs), one between the Stamp and the RF device
and one on
> the other end between the RF device and whatever. The TNCs will
negotiate
> an errorless transfer of data once it is handed to them by the
Stamp or
> device on the other end and all you need to worry about is simple
serial
> send receive at RS232 levels. Most TNCs will accept 0 - 5 volts
as well as
> true RS232. They typically run 1200 baud, but can be slowed to
300
> baud. Some higher cost units run 9600 baud. You can set the
Stamp-to-TNC
> data rate and the TNC-TNC data rate separately, meaning you can
communicate
> Stamp to TNC at say 1200 baud and use 300 baud for TNC-TNC to
improve
> transfer rate on a marginal path. The TNCs will retry until they
get thru
> or time out. You can set them to NEVER time out in which case
they try
> forever. The TNCs will perform a full end-to-end acknowledgement
that is
> completely transparent to the Stamp.
>
> Since they contain a fairly large send/receive buffer, you can set
the comm
> rate from Stamp to TNC at say 300 baud or 1200 baud and let TNC
> communication remain at 1200 baud.
>
> A source of such devices is Kantronics, http://www.kantronics.com/
>
> You can also find these things used on eBay considerably cheaper
than new.
>
> Jim H



________________________________________________________________________
________________________________________________________________________

Message: 2
Date: Wed, 1 May 2002 04:42:38 -0700 (PDT)
From: Johann Cover <curruption@y...>
Subject: Pics Programing

Can any on advise me on how to build a simple pic progamer that is able
to program a PIC
that has built in serial comunication, at least one A/D convertorand
more that 4 I/P
pins. Also the pic should have no more that 16Pins (if possible)

I want to us the pic to help me build the folowing things
A high power (40W motors) digital servos that is control by serial
comuniction
A digital rpm read that send the data through sreial comuniction
A simple H-brige speed control, that controled by serial comuniction
Each ablication would have its own PIC to creat a type of modular system
that runs on
some form a serial data bus that carries data back and forth from BS2-IC
to each module.


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com


________________________________________________________________________
________________________________________________________________________

Message: 3
Date: Wed, 01 May 2002 12:03:03 -0000
From: "rhess_1" <rhess@a...>
Subject: Re: LTC1298

--- In basicstamps@y..., Beau Schwabe <bschwabe@a...> wrote:
> At 10:44 PM 4/30/2002, you wrote:
> >Has anyone encountered this before? While reading a
> >value from channels 0 and 1 of the ADC I see 2047 when
> >input voltage is 2.505 and a reading of 0000 when the
> >input is 2.506 0001 @ 2.507 and so on up to 2047 again
> >for 5.01. What gives, I am hoping someone here is
> >smarter than me (with out a doubt) and can tell me why
> >this could happen. I have tried 3 chips, same result.
>
> I seem to remember something about this particular
> ADC having a single or differential mode of operation.
> It sounds as though you are in a differential mode.
>
> http://www.linear.com/pdf/128698fs.pdf
> Reading the datasheet on page 9...
>
> "The LTC1298 has a two-channel input multiplexer and can
> convert either channel with respect to ground or the difference
> between the two."
>
> Look at page 12 under the Multiplexer (MUX) Address on how
> to set the LTC1298 Channel Selection.
>
>

> Beau Schwabe Mask Designer IV - ATL
> National Semiconductor Enterprise Networking Business
Unit
> 500 Pinnacle Court, Suite 525 Wired Communications Division
> Mail Stop GA1 Norcross, GA 30071
>
--

Looked at the Datasheet, not much new there. I think I am doing this
stuff right, I may be wrong! Here is a snippet of the code used to
read the 1298:

config var nib
WorkVar var word
AD var word

startB var config.bit0
sglDif var config.bit1
ChanSel var config.bit2
msbf var config.bit3
.
.
.

ChanSel = 0
GOSUB ReadADC
WorkVar = AD
.
.
.

ChanSel = 1
GOSUB ReadADC
WorkVar = AD
.
.
.

ReadADC:
config = config | %1011
LOW ChipSel
PAUSE 40
SHIFTOUT DIO_n,CLK,lsbfirst,[noparse][[/noparse]config\4]
SHIFTIN DIO_n,CLK,msbpost,[noparse][[/noparse]AD\12]
HIGH ChipSel
RETURN




________________________________________________________________________
________________________________________________________________________

Message: 4
Date: Wed, 01 May 2002 12:03:30 -0000
From: "rhess_1" <rhess@a...>
Subject: Re: LTC1298

--- In basicstamps@y..., Beau Schwabe <bschwabe@a...> wrote:
> At 10:44 PM 4/30/2002, you wrote:
> >Has anyone encountered this before? While reading a
> >value from channels 0 and 1 of the ADC I see 2047 when
> >input voltage is 2.505 and a reading of 0000 when the
> >input is 2.506 0001 @ 2.507 and so on up to 2047 again
> >for 5.01. What gives, I am hoping someone here is
> >smarter than me (with out a doubt) and can tell me why
> >this could happen. I have tried 3 chips, same result.
>
> I seem to remember something about this particular
> ADC having a single or differential mode of operation.
> It sounds as though you are in a differential mode.
>
> http://www.linear.com/pdf/128698fs.pdf
> Reading the datasheet on page 9...
>
> "The LTC1298 has a two-channel input multiplexer and can
> convert either channel with respect to ground or the difference
> between the two."
>
> Look at page 12 under the Multiplexer (MUX) Address on how
> to set the LTC1298 Channel Selection.
>
>

> Beau Schwabe Mask Designer IV - ATL
> National Semiconductor Enterprise Networking Business
Unit
> 500 Pinnacle Court, Suite 525 Wired Communications Division
> Mail Stop GA1 Norcross, GA 30071
>
--



________________________________________________________________________
________________________________________________________________________

Message: 5
Date: Wed, 01 May 2002 12:03:35 -0000
From: "manish_shrestha" <manish_shrestha@y...>
Subject: Connecting to C++

Can Anyone please please please please help me with this....I am
really in a deep trouble with thisthing.!!![noparse]:([/noparse]

I got my Basic Stamp to send me a character whenever a light is
blocked on a led...but I am not able to receive this character in my
C++ program....I am on a UNIX system. What I need to do is, i need
to find the time difference between two LED emissions...upon which,
I have made the Basic stamp to send a character to the serial port
everytime the LED emits a voltage. Can anyone help me out on how I
can change the input device on the C++ program from the keyboard to
the serial port ?

Thanks
PEACE!!
MShrestha




________________________________________________________________________
________________________________________________________________________

Message: 6
Date: Wed, 01 May 2002 12:25:01 +0000
From: "norman doty" <normdoty@h...>
Subject: Re: Re: LTC1298

its possible your in differential mode, but your read-back command might
not
be correct or your read variables might be byte instead of word, or a
combination of all or some of the above problems.

norm




>From: "rhess_1" <rhess@a...>
>Reply-To: basicstamps@yahoogroups.com
>To: basicstamps@yahoogroups.com
>Subject: [noparse][[/noparse]basicstamps] Re: LTC1298
>Date: Wed, 01 May 2002 12:03:30 -0000
>
>--- In basicstamps@y..., Beau Schwabe <bschwabe@a...> wrote:
> > At 10:44 PM 4/30/2002, you wrote:
> > >Has anyone encountered this before? While reading a
> > >value from channels 0 and 1 of the ADC I see 2047 when
> > >input voltage is 2.505 and a reading of 0000 when the
> > >input is 2.506 0001 @ 2.507 and so on up to 2047 again
> > >for 5.01. What gives, I am hoping someone here is
> > >smarter than me (with out a doubt) and can tell me why
> > >this could happen. I have tried 3 chips, same result.
> >
> > I seem to remember something about this particular
> > ADC having a single or differential mode of operation.
> > It sounds as though you are in a differential mode.
> >
> > http://www.linear.com/pdf/128698fs.pdf
> > Reading the datasheet on page 9...
> >
> > "The LTC1298 has a two-channel input multiplexer and can
> > convert either channel with respect to ground or the difference
> > between the two."
> >
> > Look at page 12 under the Multiplexer (MUX) Address on how
> > to set the LTC1298 Channel Selection.
> >
> >
>
> > Beau Schwabe Mask Designer IV - ATL
> > National Semiconductor Enterprise Networking Business
>Unit
> > 500 Pinnacle Court, Suite 525 Wired Communications Division
> > Mail Stop GA1 Norcross, GA 30071
> >
>--
>
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject
and
>Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com



________________________________________________________________________
________________________________________________________________________

Message: 7
Date: Wed, 1 May 2002 07:38:10 -0500
From: "Al Williams" <alw@a...>
Subject: RE: Connecting to C++

What you want is in sys/termios.h

You need to know the device name of your serial port
(/dev/tty? Maybe? Some systems uses /dev/cua?). Use open() to open it.
You may need flags like O_NONBLOCK (keeps it from waiting
For carrier detect and O_NOCTTY so that the port can't become a control
terminal).

You can use tcgetattr() to get the current settings of the port. It is
best to modify the existing settings instead of building a termios
structure from scratch. Read the docs on termios - you'll want to set up
a bunch of parameters there. You can use cfsetispeed() and cfsetospeed()
to set the baud rates. I theory they don't have to match, but in
practice...

Use tcsetattr to set device modes. I've heard you may want to use fcntl
to make sure O_NONBLOCK off again, but I've not had any problems.


Then you can use read/write or you could use fdopen or something similar
to wrap the file handle into a FILE * (or use an iostream constructor
that takes a file handle).

In the termios flags, you'll probably want all flags in c_iflag and
c_oflag =0. The c_cflag strucutre requrires you to "merge" your bit size
in:

tios.c_cflag &= ~CSIZE;
tios.c_cflag |= CS8;

You probably also want to set CREAD and HUPCL -- read the man page.

c_lflag has ICANON (line processing - you want this off), ECHO (off) and
ISIG (off).

Other functions:
tcflush (you want to call this before close()).
tcdrain
tcsendbreak
tcflow

Here are some references. Keep in mind that this is one place where
systems vary quite a bit:

http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/files/aixfiles/t
ermios.h.htm

http://www.etek.chalmers.se/~e5arta/LINUX/TERMIOS/termios.html

A search for termios and your OS name would be a good idea.

Al Williams
AWC
* Easy RS-232 Prototyping
http://www.al-williams.com/awce/rs1.htm


>
Original Message
> From: manish_shrestha [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=571adXudFDdpOtO2TwCAXx8FEX-p7ugtKexYnbSsZfXEeUUqvv7cj0mWlnvWwshCuQyr4thanGIZJA46VV3zKtE]manish_shrestha@y...[/url
> Sent: Wednesday, May 01, 2002 7:04 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Connecting to C++
>
>
> Can Anyone please please please please help me with this....I am
> really in a deep trouble with thisthing.!!![noparse]:([/noparse]
>
> I got my Basic Stamp to send me a character whenever a light is
> blocked on a led...but I am not able to receive this character in my
> C++ program....I am on a UNIX system. What I need to do is, i need
> to find the time difference between two LED emissions...upon which,
> I have made the Basic stamp to send a character to the serial port
> everytime the LED emits a voltage. Can anyone help me out on how I
> can change the input device on the C++ program from the keyboard to
> the serial port ?
>
> Thanks
> PEACE!!
> MShrestha
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>



________________________________________________________________________
________________________________________________________________________

Message: 8
Date: Wed, 1 May 2002 06:09:48 -0700 (PDT)
From: Manish Shrestha <manish_shrestha@y...>
Subject: RE: Connecting to C++

Thanks a lot for the help...but I still have a
problem...I am not able to figure out which port my
circuit is connected to...I tried opening all of the
following ports...and this is what I got:

PORT: cua0
MESSAGE: unable to open /dev/cua0 -: Deviec or
resource busy

PORT cua1
MESSAGE: tty_io.c: process 1214(a.out) used obsolete
/dev/cua1 - update software to use /dev/ttys1

PORT cua2
MESSAGE: tty_io.c: process 1204(a.out) used obsolete
/dev/cua2 - update software to use /dev/ttys2

PORT TTYS0
MESSAGE: Unable to open /dev/ttys0 -: Input/Output
Error

PORT TTYS1
MESSAGE: Unable to open /dev/ttys1 -: Input/Output
Error

PORT TTYS2
MESSAGE: Unable to open /dev/ttys2 -: Input/Output
Error

So which port is my circuit device connected to??

Thanks Bye

Manish
--- Al Williams <alw@a...> wrote:
> What you want is in sys/termios.h
>
> You need to know the device name of your serial port
> (/dev/tty? Maybe? Some systems uses /dev/cua?). Use
> open() to open it.
> You may need flags like O_NONBLOCK (keeps it from
> waiting
> For carrier detect and O_NOCTTY so that the port
> can't become a control
> terminal).
>
> You can use tcgetattr() to get the current settings
> of the port. It is
> best to modify the existing settings instead of
> building a termios
> structure from scratch. Read the docs on termios -
> you'll want to set up
> a bunch of parameters there. You can use
> cfsetispeed() and cfsetospeed()
> to set the baud rates. I theory they don't have to
> match, but in
> practice...
>
> Use tcsetattr to set device modes. I've heard you
> may want to use fcntl
> to make sure O_NONBLOCK off again, but I've not had
> any problems.
>
>
> Then you can use read/write or you could use fdopen
> or something similar
> to wrap the file handle into a FILE * (or use an
> iostream constructor
> that takes a file handle).
>
> In the termios flags, you'll probably want all flags
> in c_iflag and
> c_oflag =0. The c_cflag strucutre requrires you to
> "merge" your bit size
> in:
>
> tios.c_cflag &= ~CSIZE;
> tios.c_cflag |= CS8;
>
> You probably also want to set CREAD and HUPCL --
> read the man page.
>
> c_lflag has ICANON (line processing - you want this
> off), ECHO (off) and
> ISIG (off).
>
> Other functions:
> tcflush (you want to call this before close()).
> tcdrain
> tcsendbreak
> tcflow
>
> Here are some references. Keep in mind that this is
> one place where
> systems vary quite a bit:
>
>
http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/files/aixfiles/t
> ermios.h.htm
>
>
http://www.etek.chalmers.se/~e5arta/LINUX/TERMIOS/termios.html
>
> A search for termios and your OS name would be a
> good idea.
>
> Al Williams
> AWC
> * Easy RS-232 Prototyping
> http://www.al-williams.com/awce/rs1.htm
>
>
> >
Original Message
> > From: manish_shrestha
> [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=571adXudFDdpOtO2TwCAXx8FEX-p7ugtKexYnbSsZfXEeUUqvv7cj0mWlnvWwshCuQyr4thanGIZJA46VV3zKtE]manish_shrestha@y...[/url
> > Sent: Wednesday, May 01, 2002 7:04 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Connecting to C++
> >
> >
> > Can Anyone please please please please help me
> with this....I am
> > really in a deep trouble with thisthing.!!![noparse]:([/noparse]
> >
> > I got my Basic Stamp to send me a character
> whenever a light is
> > blocked on a led...but I am not able to receive
> this character in my
> > C++ program....I am on a UNIX system. What I need
> to do is, i need
> > to find the time difference between two LED
> emissions...upon which,
> > I have made the Basic stamp to send a character to
> the serial port
> > everytime the LED emits a voltage. Can anyone help
> me out on how I
> > can change the input device on the C++ program
> from the keyboard to
> > the serial port ?
> >
> > Thanks
> > PEACE!!
> > MShrestha
> >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed.
> Text in the
> > Subject and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed.
> Text in the Subject and Body of the message will be
> ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com


________________________________________________________________________
________________________________________________________________________

Message: 9
Date: Wed, 1 May 2002 09:14:12 -0400
From: "Robert McCown" <rmccown@w...>
Subject: Introduction


Hi there
I'm new to the group, but not new to stamps. I have an old Lynxmotion
hexapod robot that is controlled by a first generation stamp 2 and a
couple
of SSC's. I just purchased a stamp 2p, and assorted goodies to go with
it,
and am looking for some projects to get my feet wet.

Anyone have any good ideas for first projects for someone who isnt new
to
programming or hardware, but needs a couple of good ideas?

Thanks in advance

-=Bob




________________________________________________________________________
________________________________________________________________________

Message: 10
Date: Wed, 1 May 2002 08:50:57 -0500
From: "Al Williams" <alw@a...>
Subject: RE: Connecting to C++

I can't tell where your device is connected. However, you should disable
login from holding that port open. This is handled by getty and there is
usually a /etc/conf.getty (or /etc/conf.getty.line). You need to remove
the port you want to use from that file or else you won't be able to
open it.

I'd hook a modem or other serial device to the port and try using a
termial program to talk to it. Then you'd know which port you were on
and that it was free for use.

Al Williams
AWC



________________________________________________________________________
________________________________________________________________________

Message: 11
Date: Wed, 1 May 2002 09:51:42 EDT
From: azeasi@a...
Subject: Re: Circuit Simulation Software

MultiSim 2001 (2002?) is a good low cost package that can be expanded as

desired. It is also capable of adding PCB layout autorouting etc. It
isn't
free but is great for beginners and technician level hobbyists, but also
has
features required by Engineering professionals. It used to be called
Electronics workbench.


________________________________________________________________________
________________________________________________________________________

Message: 12
Date: Wed, 01 May 2002 08:29:36 -0400
From: Beau Schwabe <bschwabe@a...>
Subject: Re: Re: LTC1298

At 12:03 PM 5/1/02 +0000, you wrote:
>--- In basicstamps@y..., Beau Schwabe <bschwabe@a...> wrote:
> > At 10:44 PM 4/30/2002, you wrote:
> > >Has anyone encountered this before? While reading a
> > >value from channels 0 and 1 of the ADC I see 2047 when
> > >input voltage is 2.505 and a reading of 0000 when the
> > >input is 2.506 0001 @ 2.507 and so on up to 2047 again
> > >for 5.01. What gives, I am hoping someone here is
> > >smarter than me (with out a doubt) and can tell me why
> > >this could happen. I have tried 3 chips, same result.
> >
> > I seem to remember something about this particular
> > ADC having a single or differential mode of operation.
> > It sounds as though you are in a differential mode.
> >
> > http://www.linear.com/pdf/128698fs.pdf
> > Reading the datasheet on page 9...
> >
> > "The LTC1298 has a two-channel input multiplexer and can
> > convert either channel with respect to ground or the difference
> > between the two."
> >
> > Look at page 12 under the Multiplexer (MUX) Address on how
> > to set the LTC1298 Channel Selection.
> >
> >
>
> > Beau Schwabe Mask Designer IV - ATL
> > National Semiconductor Enterprise Networking Business
>Unit
> > 500 Pinnacle Court, Suite 525 Wired Communications Division
> > Mail Stop GA1 Norcross, GA 30071
> >
>--
>
>Looked at the Datasheet, not much new there. I think I am doing this
>stuff right, I may be wrong! Here is a snippet of the code used to
>read the 1298:
>
>config var nib
>WorkVar var word
>AD var word
>
>startB var config.bit0
>sglDif var config.bit1
>ChanSel var config.bit2
>msbf var config.bit3
> .
> .
> .
>
>ChanSel = 0
>GOSUB ReadADC
>WorkVar = AD
> .
> .
> .
>
>ChanSel = 1
>GOSUB ReadADC
>WorkVar = AD
> .
> .
> .
>
>ReadADC:
> config = config | %1011
> LOW ChipSel
> PAUSE 40
> SHIFTOUT DIO_n,CLK,lsbfirst,[noparse][[/noparse]config\4]
> SHIFTIN DIO_n,CLK,msbpost,[noparse][[/noparse]AD\12]
> HIGH ChipSel
> RETURN

Unless something is getting inverted in your code with MSB,LSB I
don't know what to tell you, except it doesn't look like 'lsbfirst'
or 'msbpost' are initializing in your code. Try setting your
'config' to all 1's or try to decipher some of my code I have below
for an LTC1288.

Code Starts Here (MEL Basic StampI
compatable)

Symbol PortA = 5 'RA0 through RA4
Symbol TrisA = $85 'PortA Direction Control
Symbol ADC_CLK = 0 'Pin 7 on LTC1288
Symbol ADC_DataPin = 1 'Pin 5 on LTC1288
Symbol ADC_Mode = 1 '0 = diff. ;1 = Single-ended
input
Symbol ADC_Data_Out_Bit = pin1 'OUTPUT bit data to pin
Symbol ADC_Data_In_Bit = pin1 'INPUT bit data from pin
Symbol Temp = w0 'Temporary variable
Symbol ADC_Channel = bit0 'W0;Temporary BIT flag
Symbol ADC_Shift_In = b2 'W1.LOWBYTE
Symbol ADC_Data_In_WORD = w2 'B4 and B5
Symbol ADC_1 = w3 'B6 and B7
Symbol ADC_2 = w4 'B8 and B9

Initialize:
Poke TrisA,%11110011:Poke PortA,%00001100

MainLoop:

'Read ADC
Poke TrisA,%11110011
ADC_Channel = 0:gosub Read_ADC:ADC_1 = ADC_Data_In_WORD
ADC_Channel = 1:gosub Read_ADC:ADC_2 = ADC_Data_In_WORD

'Debug ADC_1 and ADC_2 for results
goto MainLoop


Read_ADC: output ADC_DataPin:low ADC_CLK:high ADC_DataPin
Poke PortA,%00001000[noparse]:p[/noparse]ulsout ADC_CLK,1
ADC_Data_Out_Bit = ADC_Mode [noparse]:p[/noparse]ulsout ADC_CLK,1
ADC_Data_Out_Bit = ADC_Channel[noparse]:p[/noparse]ulsout ADC_CLK,1
ADC_Data_Out_Bit = 1 [noparse]:p[/noparse]ulsout ADC_CLK,1
input ADC_DataPin:ADC_Data_In_WORD = 0
'for ADC_Shift_In = 1 to 13
for ADC_Shift_In = 1 to 11 '<<- Use 11 instead of 13 to
' "prescale" or effectively
' "divide" the result by a
' factor of 4

ADC_Data_In_WORD = ADC_Data_In_WORD * 2 + ADC_Data_In_Bit
pulsout ADC_CLK,1[noparse]:next:[/noparse]Poke PortA,%00001100:return


Beau Schwabe Mask Designer IV - ATL
National Semiconductor Enterprise Networking Business Unit
500 Pinnacle Court, Suite 525 Wired Communications Division
Mail Stop GA1 Norcross, GA 30071



________________________________________________________________________
________________________________________________________________________

Message: 13
Date: Wed, 1 May 2002 15:06:59 +0100
From: "Justin" <justin@j...>
Subject: RE: Circuit Simulation Software

As a side issue, does anyone know if Protel files can be converted to
work
with any other (cheaper) packages, or if there are any other PCB
applications that can work with Protel files ?

Regards,
Justin.

Original Message
From: azeasi@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=AfBtI1q58gZs78LG7GGRRqm03u840d2fMnY3JLkwhg1N7Ummr6ppPg05avWbaCNJ8U43HCej]azeasi@a...[/url
Sent: 01 May 2002 14:52
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Circuit Simulation Software


MultiSim 2001 (2002?) is a good low cost package that can be expanded as
desired. It is also capable of adding PCB layout autorouting etc. It
isn't
free but is great for beginners and technician level hobbyists, but also
has
features required by Engineering professionals. It used to be called
Electronics workbench.

To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and
Body of the message will be ignored.


Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/




________________________________________________________________________
________________________________________________________________________

Message: 14
Date: Wed, 1 May 2002 07:12:09 -0700
From: "David Covick" <dac@w...>
Subject: Re: Circuit Simulation Software

Justin,

CircuitMaker works with Protel. It is their lower cost package that
includes TraxMaker.

http://www.circuitmaker.com/

David

Original Message
From: "Justin" <justin@j...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, May 01, 2002 7:06 AM
Subject: RE: [noparse][[/noparse]basicstamps] Circuit Simulation Software


> As a side issue, does anyone know if Protel files can be converted to
work
> with any other (cheaper) packages, or if there are any other PCB
> applications that can work with Protel files ?
>
> Regards,
> Justin.
>
>
Original Message
> From: azeasi@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=AfBtI1q58gZs78LG7GGRRqm03u840d2fMnY3JLkwhg1N7Ummr6ppPg05avWbaCNJ8U43HCej]azeasi@a...[/url
> Sent: 01 May 2002 14:52
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Circuit Simulation Software
>
>
> MultiSim 2001 (2002?) is a good low cost package that can be expanded
as
> desired. It is also capable of adding PCB layout autorouting etc. It
isn't
> free but is great for beginners and technician level hobbyists, but
also
has
> features required by Engineering professionals. It used to be called
> Electronics workbench.
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
and
> Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
>



________________________________________________________________________
________________________________________________________________________

Message: 15
Date: Wed, 01 May 2002 10:34:31 -0400
From: Leroy Hall <leroy@f...>
Subject: Serin baud rate

Is it possible to set the serin baud rate to a value other than what's
in the tables? I need about 900 baud 1 start bit - one stop bit - even
parity. Maybe some of you that really know the inside of this thing can
comment. I looked at the table in the manual and didn't get any hints.
Thanks for you help..

Leroy



________________________________________________________________________
________________________________________________________________________

Message: 16
Date: Wed, 01 May 2002 09:29:36 -0400
From: Beau Schwabe <bschwabe@a...>
Subject: Re: Serin baud rate

At 10:34 AM 5/1/02 -0400, you wrote:
>Is it possible to set the serin baud rate to a value other than what's
>in the tables? I need about 900 baud 1 start bit - one stop bit - even
>parity. Maybe some of you that really know the inside of this thing can
>comment. I looked at the table in the manual and didn't get any hints.
>Thanks for you help..
>
>Leroy



You can use this formula to calculate the 'baudmode'


baudmode = (10000/(BAUD/100))-20

Where 'baudmode' is the value the Stamp must use
and 'BAUD' is the ACTUAL baud that you desire.


ie: BAUD = 9600

baudmode = (10000/(9600/100))-20
= (10000/96)-20
= 104-20
= 84

BAUD = 900

baudmode = (10000/(900/100))-20
= (10000/9)-20
= 1111-20
= 1091


Code Example:

baud var byte
baud = 1091
serout 16,baud+$4000,[noparse][[/noparse]"Hello"]



Beau Schwabe Mask Designer IV - ATL
National Semiconductor Enterprise Networking Business Unit
500 Pinnacle Court, Suite 525 Wired Communications Division
Mail Stop GA1 Norcross, GA 30071



________________________________________________________________________
________________________________________________________________________

Message: 17
Date: Wed, 01 May 2002 09:40:14 -0400
From: Beau Schwabe <bschwabe@a...>
Subject: Re: Serin baud rate

At 10:34 AM 5/1/02 -0400, you wrote:
>Is it possible to set the serin baud rate to a value other than what's
>in the tables? I need about 900 baud 1 start bit - one stop bit -
even
>parity. Maybe some of you that really know the inside of this thing
can
>comment. I looked at the table in the manual and didn't get any hints.
>Thanks for you help..
>
>Leroy

Here is another copy of an E-mail that I sent out several years ago
about
this subject. Found in the Stamp Archives under a search for "BAUD
Formula".
http://www.jamesrusso.com/stamp/


"Baudmode is the bit period expressed in microseconds-20 (i.e.300 baud
is 3313). Baudmode's bit 15 ($8000) is 0 for driven, 1 for
open-drain/
open-source (SEROUT). Baudmode's bit 14 ($4000) is 0 for true, 1 for
inverted. Baudmode's bit 13 ($2000) is 0 for 8-bit no parity, 1 for
7-bit
parity"

396 is the BASE number you need to use for 2400 baud. At 2400 as your
base number your actual baud come out to something like 413bps

...for 2400 baud, 8-bit, no parity, true data, driven output use...
SEROUT 8,396,[noparse][[/noparse]$3,$0]

...for 2400 baud, 7-bit, parity, true data, driven output use...
SEROUT 8,396+$2000,[noparse][[/noparse]$3,$0]

...for 2400 baud, 8-bit, no parity, inverted data, driven output
use...
SEROUT 8,396+$4000,[noparse][[/noparse]$3,$0]

...for 2400 baud, 7-bit, parity, inverted data, driven output use...
SEROUT 8,396+$6000,[noparse][[/noparse]$3,$0]

...for 2400 baud, 8-bit, no parity, true data, open drain/source
use...
SEROUT 8,396+$8000,[noparse][[/noparse]$3,$0]


...To Calculate the baud number (ie 396) you can use the "stamp
friendly"
formula below. Stamp friendly, because you can use it within a program
making it easy to change the baud by entering the actual baud (ie 2400)

BaudValue = (10000/(Baud/100))-20
= (10000/(2400/100))-20
= (10000/24)-20
= 416-20 <- Fractions are truncated
= 396

'Program Example:
Initialize:
Baud con 2400 '<- actual Baud value
BaudValue var Word

BaudValue = (10000/(Baud/100))-20 '<- Parallax Conversion

MainLoop:
'Button Detection routines go here
SEROUT 8,BaudValue,[noparse][[/noparse]$3,$0]
goto MainLoop
Beau Schwabe Mask Designer IV - ATL
National Semiconductor Enterprise Networking Business Unit
500 Pinnacle Court, Suite 525 Wired Communications Division
Mail Stop GA1 Norcross, GA 30071



________________________________________________________________________
________________________________________________________________________

Message: 18
Date: Wed, 1 May 2002 16:27:46 +0100
From: "Justin" <justin@j...>
Subject: RE: Circuit Simulation Software

Thanks David.
I just downloaded their trial version, now to see if I can justify the
$995
price tag !

Regards,
Justin.


Original Message
From: David Covick [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=fh3Bg1-5l23lwAWAmjKXb1UJxdbANrC_2oU4e3HTNlSO-2IWqRNSHulgqhzRe050kZFn]dac@w...[/url
Sent: 01 May 2002 15:12
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Circuit Simulation Software


Justin,

CircuitMaker works with Protel. It is their lower cost package that
includes TraxMaker.

http://www.circuitmaker.com/

David

Original Message
From: "Justin" <justin@j...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, May 01, 2002 7:06 AM
Subject: RE: [noparse][[/noparse]basicstamps] Circuit Simulation Software


> As a side issue, does anyone know if Protel files can be converted to
work
> with any other (cheaper) packages, or if there are any other PCB
> applications that can work with Protel files ?
>
> Regards,
> Justin.
>
>
Original Message
> From: azeasi@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=AfBtI1q58gZs78LG7GGRRqm03u840d2fMnY3JLkwhg1N7Ummr6ppPg05avWbaCNJ8U43HCej]azeasi@a...[/url
> Sent: 01 May 2002 14:52
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Circuit Simulation Software
>
>
> MultiSim 2001 (2002?) is a good low cost package that can be expanded
as
> desired. It is also capable of adding PCB layout autorouting etc. It
isn't
> free but is great for beginners and technician level hobbyists, but
also
has
> features required by Engineering professionals. It used to be called
> Electronics workbench.
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
and
> Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
>


To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and
Body of the message will be ignored.


Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/




________________________________________________________________________
________________________________________________________________________

Message: 19
Date: Wed, 1 May 2002 10:33:00 -0500
From: "Ricky Konvicka" <ricky@m...>
Subject: BCD for DS1307


Can someone explain BCD for me. I am trying to write some code to set
the functions of the clock but I am confused on how to display or work
with my numbers. Do I use hex or decimal? It seems that when I set the
register to what I want then go to display it I get a 2a or something
like that.


[noparse][[/noparse]Non-text portions of this message have been removed]



________________________________________________________________________
________________________________________________________________________



Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Sign In or Register to comment.