Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Discussion Groups

Discussion Groups | Piclist | RE: external a to d converer

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Serout2,Serin2 Help - ramtec73 - Mar 6 1:08:00 2004


Here is what I have. I am using a PIC16F877A and PICBasic Pro

DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_COMMANDUS 2000
DEFINE DATAUS 50
DEFINE OSC 10

include "modedefs.bas"

temp VAR WORD TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000101
Low PORTE.2 ' LCD R/W line low

Pause 500 ' Wait .5 second

LCDout $fe,1
LCDout "test serout"

temp=5
loop:

Serout2 PORTE.2,4,[temp] '2400 rate
Serin2 PORTA.2,4[Dec temp]

LCDout $fe.$c0,temp
Goto Loop
end So far all I see on the LCD is just 'test serout' on the first line.
I thought this line of codes will print 'test serout' on the first
line and '5' on the second line.

Does anyone see any mistake in this coding?

Thanks
Randy





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Serout2,Serin2 Help - Charles Linquist - Mar 6 1:41:00 2004


You need a comma, not a period between $FE and $C0

Charles Linquist -----Original Message-----
From: ramtec73 [mailto:]
Sent: Friday, March 05, 2004 10:09 PM
To:
Subject: [piclist] Serout2,Serin2 Help

Here is what I have. I am using a PIC16F877A and PICBasic Pro

DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_COMMANDUS 2000
DEFINE DATAUS 50
DEFINE OSC 10

include "modedefs.bas"

temp VAR WORD TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000101
Low PORTE.2 ' LCD R/W line low

Pause 500 ' Wait .5 second

LCDout $fe,1
LCDout "test serout"

temp=5
loop:

Serout2 PORTE.2,4,[temp] '2400 rate
Serin2 PORTA.2,4[Dec temp]

LCDout $fe.$c0,temp
Goto Loop
end So far all I see on the LCD is just 'test serout' on the first line.
I thought this line of codes will print 'test serout' on the first line and
'5' on the second line.

Does anyone see any mistake in this coding?

Thanks
Randy

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
Yahoo! Groups Links





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Serout2,Serin2 Help - ramtec73 - Mar 6 20:04:00 2004

Has anyone tried sending and receiving on the same pic using
Serin/Serin2 and Serout/Serout2?
--- In , "Charles Linquist" <Charles@L...>
wrote:
>
> You need a comma, not a period between $FE and $C0
>
> Charles Linquist > -----Original Message-----
> From: ramtec73 [mailto:anilram@e...]
> Sent: Friday, March 05, 2004 10:09 PM
> To:
> Subject: [piclist] Serout2,Serin2 Help
>
> Here is what I have. I am using a PIC16F877A and PICBasic Pro
>
> DEFINE LCD_DREG PORTD
> DEFINE LCD_DBIT 4
> DEFINE LCD_RSREG PORTE
> DEFINE LCD_RSBIT 0
> DEFINE LCD_EREG PORTE
> DEFINE LCD_EBIT 1
> DEFINE LCD_COMMANDUS 2000
> DEFINE DATAUS 50
> DEFINE OSC 10
>
> include "modedefs.bas"
>
> temp VAR WORD > TRISA = %11111111 ' Set PORTA to all input
> ADCON1 = %10000101
> Low PORTE.2 ' LCD R/W line low
>
> Pause 500 ' Wait .5 second
>
> LCDout $fe,1
> LCDout "test serout"
>
> temp=5
> loop:
>
> Serout2 PORTE.2,4,[temp] '2400 rate
> Serin2 PORTA.2,4[Dec temp]
>
> LCDout $fe.$c0,temp
> Goto Loop
> end > So far all I see on the LCD is just 'test serout' on the first
line.
> I thought this line of codes will print 'test serout' on the first
line and
> '5' on the second line.
>
> Does anyone see any mistake in this coding?
>
> Thanks
> Randy >
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> Yahoo! Groups Links




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serout2,Serin2 Help - Author Unknown - Mar 6 20:08:00 2004

In a message dated 3/6/2004 8:05:20 PM Eastern Standard Time, a...@engineer.com writes:


Has anyone tried sending and receiving on the same pic using
Serin/Serin2 and Serout/Serout2?


You can't do that because when the PIC gets to serin the message has already been sent and there is nothing there to receive. 

Sid




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serout2,Serin2 Help - randy ram - Mar 6 20:35:00 2004

I am using a 877A. Can I then transmit from it and receive on another PIC such as the 628? I guess that can be done. I guess I will have to turn the 628  (rx) first before the 877A(tx). Next question will be how will I set us the the receiving PIC? Will the same code that I post on this topic work?

Thanks

Randy

----- Original Message -----
From: N...@aol.com
Date: Sat, 6 Mar 2004 20:08:17 EST
To: p...@yahoogroups.com
Subject: Re: [piclist] Re: Serout2,Serin2 Help

In a message dated 3/6/2004 8:05:20 PM Eastern Standard Time, a...@engineer.com writes:


Has anyone tried sending and receiving on the same pic using
Serin/Serin2 and Serout/Serout2?


You can't do that because when the PIC gets to serin the message has already been sent and there is nothing there to receive. 

Sid


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions


--

___________________________________________________________
Sign-up for Ads Free at Mail.com
http://www.mail.com/?sr=signup






(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serout2,Serin2 Help - Author Unknown - Mar 7 8:54:00 2004

In a message dated 3/6/2004 8:36:18 PM Eastern Standard Time, a...@engineer.com writes:


I am using a 877A. Can I then transmit from it and receive on another PIC such as the 628? I guess that can be done. I guess I will have to turn the 628  (rx) first before the 877A(tx). Next question will be how will I set us the the receiving PIC? Will the same code that I post on this topic work?

Thanks

Here is a way to establish communication between two PICs:

Master

start:
serout2 so, N9600, ["X"]
serin2 si, N9600, 1000, nocom,[com]
debug cls
debug "Communication established with PIC.",cr
pause 1500
goto init1

nocom:
goto start

init1:
(Main program)

Slave:

Start:
serin2 si, baud, [com]
serout2 so, baud, ["X"]

main:
(slave waits for instructions)

If you are in a noisy environment, you might want to write for the master:

serout2 so, baud, ["ABC", "X"]

and for the slave:

serin2 si, baud, [wait("ABC"), com]

The ABC on serin ensures that the slave will wait for a transmission beginning with "ABC" and will ignore all other signals.

Once you have established communication, you can send the slave other commands to have it perform a task.  Remember that the PIC has no buffer, so when you send a command from the master to the slave, the slave must be sitting there waiting for it, not off doing something else.

The connections between the PIC serin and serout lines should be via a 270 ohm resistor to protect the I/O ports.

Sid




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

external a to d converer - jean michel urbani - Mar 7 9:33:00 2004

hello List,

I have lingered on the net for the last 2 monthes to
try to get info on how to use an external ad converter
with a pic 16F628 and can't nanaged get it.

could someone help me ?

thanks

jean mi
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com






(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: external a to d converer - Wouter van Ooijen - Mar 7 9:37:00 2004

> I have lingered on the net for the last 2 monthes to
> try to get info on how to use an external ad converter
> with a pic 16F628 and can't nanaged get it.

You'd have to buy an nw chip, so why not buy a PIC with A/D? Check for
instance the 16F88.

If you realy want an external A/D you need to interface it, so what
would you use? parallel, SPI, I2C?

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: external a to d converer - Chad Russel - Mar 7 12:51:00 2004

Is this the fuel cell output? Many things have to be taken into
account when choosing an A to D. If you know it has to be external,
then it must be special. Maxim makes some very good AtoDs with 3 wire
interfaces.

Chad
--- jean michel urbani <> wrote:
> hello List,
>
> I have lingered on the net for the last 2 monthes to
> try to get info on how to use an external ad converter
> with a pic 16F628 and can't nanaged get it.
>
> could someone help me ?
>
> thanks
>
> jean mi >
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout
> !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger
> !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
=====
My software has no bugs. Only undocumented features.

__________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serout2,Serin2 Help - randy ram - Mar 7 20:36:00 2004

Why is that everytime I use the 'wait' in say,

serin2 si, N9600, [wait("ABC"), com]

I get an error saying Bad expression. If I remove it, there is no error. But I rather use the wait. Is there anything I have to declare or define something at the top of the program?

Randy

----- Original Message -----
From: N...@aol.com
Date: Sun, 7 Mar 2004 08:54:15 EST
To: p...@yahoogroups.com
Subject: Re: [piclist] Re: Serout2,Serin2 Help

In a message dated 3/6/2004 8:36:18 PM Eastern Standard Time, a...@engineer.com writes:


I am using a 877A. Can I then transmit from it and receive on another PIC such as the 628? I guess that can be done. I guess I will have to turn the 628  (rx) first before the 877A(tx). Next question will be how will I set us the the receiving PIC? Will the same code that I post on this topic work?

Thanks

Here is a way to establish communication between two PICs:

Master

start:
serout2 so, N9600, ["X"]
serin2 si, N9600, 1000, nocom,[com]
debug cls
debug "Communication established with PIC.",cr
pause 1500
goto init1

nocom:
goto start

init1:
(Main program)

Slave:

Start:
serin2 si, baud, [com]
serout2 so, ba ud, ["X"]

main:
(slave waits for instructions)

If you are in a noisy environment, you might want to write for the master:

serout2 so, baud, ["ABC", "X"]

and for the slave:

serin2 si, baud, [wait("ABC"), com]

The ABC on serin ensures that the slave will wait for a transmission beginning with "ABC" and will ignore all other signals.

Once you have established communication, you can send the slave other commands to have it perform a task.  Remember that the PIC has no buffer, so when you send a command from the master to the slave, the slave must be sitting there waiting for it, not off doing something else.

The connections between the PIC serin and serout lines should be via a 270 ohm resistor to protect the I/O ports.

Sid


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



Yahoo! Groups Links
  • To


--

___________________________________________________________
Sign-up for Ads Free at Mail.com
http://www.mail.com/?sr=signup





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: external a to d converer - upand_at_them - Mar 7 20:56:00 2004

Any ADC in particular?

You have two choices for the interface: parallel or serial.

Maxim has a lot of great ADCs with serial interfaces. A few I/O
lines is all you need to communicate with them.

If you're looking for a turnkey example you may not find it, but
these are straightforward devices to work with. And if you're using
a serial ADC writing the interface code is a good learing experience.

Here are some examples I found (only took me a few seconds):
http://www.iguanalabs.com/adc2051.htm
http://www.maxim-ic.com/appnotes.cfm/appnote_number/2394/ln/en
http://www.electronic-
engineering.ch/microchip/projects/adc_test/nsc12130.html
http://www.technology.niagarac.on.ca/people/mcsele/TemperatureAlarm.ht
m
http://www.parallaxinc.com/downloads/Documentation/Application%
20Kits/LTC1298%2012-bit%20AtoD%20Converter/LTC1298%2012-bit%20AtoD%
20Converter.pdf

Mike
--- In , jean michel urbani <jmurba@y...>
wrote:
> hello List,
>
> I have lingered on the net for the last 2 monthes to
> try to get info on how to use an external ad converter
> with a pic 16F628 and can't nanaged get it.
>
> could someone help me ?
>
> thanks
>
> jean mi >
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit
partout !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serout2,Serin2 Help - Author Unknown - Mar 8 8:10:00 2004

In a message dated 3/7/2004 8:37:48 PM Eastern Standard Time, a...@engineer.com writes:


serin2 si, N9600, [wait("ABC"), com]

I get an error saying Bad expression. If I remove it, there is no error. But I rather use the wait. Is there anything I have to declare or define something at the top of the program?

That is a perfectly good command, Randy.  There are several things that could give you a "bad expression" when compiling:

si not declared
N9600 not declared
make sure your xmission is enclosed in
" [  ]  ", not  " {  }  ".

Don't know what PIC you are using - maybe it uses serin, not serin2.  Anyway,
stay with it - it is a good command.

Sid






(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serout2,Serin2 Help - randy ram - Mar 11 9:43:00 2004

Did I mention that this data was going to be displayed on to a LCD.

----- Original Message -----
From: N...@aol.com
Date: Sun, 7 Mar 2004 08:54:15 EST
To: p...@yahoogroups.com
Subject: Re: [piclist] Re: Serout2,Serin2 Help

In a message dated 3/6/2004 8:36:18 PM Eastern Standard Time, a...@engineer.com writes:


I am using a 877A. Can I then transmit from it and receive on another PIC such as the 628? I guess that can be done. I guess I will have to turn the 628  (rx) first before the 877A(tx). Next question will be how will I set us the the receiving PIC? Will the same code that I post on this topic work?

Thanks

Here is a way to establish communication between two PICs:

Master

start:
serout2 so, N9600, ["X"]
serin2 si, N9600, 1000, nocom,[com]
debug cls
debug "Communication established with PIC.",cr
pause 1500
goto init1

nocom:
goto start

init1:
(Main program)

Slave:

Start:
serin2 si, baud, [com]
serout2 so, ba ud, ["X"]

main:
(slave waits for instructions)

If you are in a noisy environment, you might want to write for the master:

serout2 so, baud, ["ABC", "X"]

and for the slave:

serin2 si, baud, [wait("ABC"), com]

The ABC on serin ensures that the slave will wait for a transmission beginning with "ABC" and will ignore all other signals.

Once you have established communication, you can send the slave other commands to have it perform a task.  Remember that the PIC has no buffer, so when you send a command from the master to the slave, the slave must be sitting there waiting for it, not off doing something else.

The connections between the PIC serin and serout lines should be via a 270 ohm resistor to protect the I/O ports.

Sid


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



Yahoo! Groups Links
  • To


--

___________________________________________________________
Sign-up for Ads Free at Mail.com
http://www.mail.com/?sr=signup





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )