Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Serial comunication between 2 PIC12f675 (Pic Basic language)

Status
Not open for further replies.

lanpu

Newbie level 1
Joined
Oct 24, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
Hi, can somebody help me please!!!

I have 2 pic12f675 and this code for a serial cominication:

Recceiver
Code:
DEVICE pic12F675,intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off
INCLUDE "modedefs.bas"

define OSCCAL_1K 1


ledr var gpio.1
leda var gpio.2
ledv var gpio.4
datos var byte

high ledr
pause 500
low ledr

recibir:

serin gpio.0,N2400,1,recibir,datos
if datos="A" then high ledr
pause 1000
if datos="B" then high leda
pause 1000
if datos="C" then high ledv
pause 1000

low ledr:low leda:low ledv
goto recibir
end

Emitter:

Code:
  DEVICE pic12F675, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off
INCLUDE "modedefs.bas"
define OSC 4 
define OSCCAL_1K 1

botonA var gpio.1
botonB var gpio.2
botonC var gpio.4

transmitir:
if botonA=0 then envio1
if botonB=0 then envio2
if botonC=0 then envio3
goto transmitir

envio1:
serout gpio.5,N2400,["A"]
pause 500
goto transmitir

envio2:
serout gpio.5,N2400,["B"]
pause 500
goto transmitir

envio3:
serout gpio.5,N2400,["C"]
pause 500
goto transmitir

end

i dont know what's wrong, somebody knows the way to do this comunication???


some example or something??

thanks!
 

yoramgr

Member level 2
Joined
Nov 4, 2010
Messages
42
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,288
Location
Israel
Activity points
1,561
If it's still relevant, I think you better try and move this question to the "Microcontrollers" forum. I'm not sure "PC Programming" is the right place.
 

lockman_akim

Advanced Member level 1
Joined
Jul 12, 2010
Messages
467
Helped
76
Reputation
152
Reaction score
68
Trophy points
1,308
Location
Malaysia
Activity points
3,535
try this


receiver:

Code:
DEVICE pic12F675,intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off
INCLUDE "modedefs.bas"

define OSCCAL_1K 1


ledr var gpio.1
leda var gpio.2
ledv var gpio.4
datos var byte

high ledr
pause 500
low ledr

recibir:

serin gpio.0,N2400,1,recibir,datos
if datos=1 then high ledr
pause 1000
if datos=2 then high leda
pause 1000
if datos=3 then high ledv
pause 1000

low ledr:low leda:low ledv
goto recibir
end


transmitter:



Code:
DEVICE pic12F675, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off, protect_off
INCLUDE "modedefs.bas"
define OSC 4 
define OSCCAL_1K 1

botonA var gpio.1
botonB var gpio.2
botonC var gpio.4

dim data as byte

transmitir:
if botonA=0 then envio1
if botonB=0 then envio2
if botonC=0 then envio3
goto transmitir

envio1:
data = 1
serout gpio.5,N2400,[data]
pause 500
goto transmitir

envio2:
data = 2
serout gpio.5,N2400,[data]
pause 500
goto transmitir

envio3:
data = 3
serout gpio.5,N2400,[data]
pause 500
goto transmitir

end
 

Dr.Schwartz

Newbie level 1
Joined
Nov 22, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,284
Does this code work has anyone tried it? Im working on a similiar program
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top