PDA

View Full Version : Interfacing Piccard with PIC16f628a?



MR2010
- 3rd May 2010, 03:09
Im writing this project for use picard(goldcard pic16f84+external eeprom 24c16) as a key of the door lock.so i need help how to read and write data on the piccard external eeprom 24c16?

MR2010
- 5th May 2010, 03:51
im still trying to sort it out.if someone has any idea how to do it plz help,

PIC16F628A

@ DEVICE XT_OSC, LVP_OFF, MCLR_OFF, WDT_OFF ,BOD_OFF,CPD_OFF,PWRT_OFF
include "modedefs.bas"
DEFINE INT_OSC 8
OPTION_REG .7 = 0
cmcon = 7 'disable portA comparators
intcon = 0 'disable interrupts
vrcon = 0
PORTA = %00000
TRISA = %00000

START:
TRISB = %00101001
IF PORTB.5 = 0 THEN S
IF PORTB.0 = 0 THEN SS
GOTO START
S:
TRISB = %00100001
T2CON = %00000100
SEROUT2 PORTB.2,17197,[ 01]
PAUSE 10
GOTO START
SS:
TRISB = %00100001
SEROUT2 PORTB.2,17197,[ 02]
PAUSE 10
GOTO START
END

PICCARD(16F84+24C16)


@ DEVICE XT_OSC, WDT_OFF
include "modedefs.bas"
define osc 8
PORTA = %00000
TRISA = %00000
PORTB = %00000001
TRISB = %00000001
CLK VAR PORTB.5
DAT VAR PORTB.4
B0 VAR BYTE
B0 = 0
G VAR BYTE
K VAR BYTE
MAIN:
SERIN2 PORTB.0,16780,[WAIT(J),DEC2 B0]
IF B0 = 01 THEN RD
IF B0 = 02 THEN WR
GOTO MAIN
WR:
FOR G = 0 TO 63
i2cwrite DAT,CLK,$a0,G,[b0]
NEXT G
RETURN
RD:
for G = 0 to 63
i2cread DAT,CLK,$a0,G,[B0]
PAUSE 10
RETURN
END

im trying to write data to piccard external eeptom and read it useing pic16f628 connected to pic card, well plz is there any better way todo it i want to write and read derect data to the external eeprom without writing a code in piccard?

Melanie
- 5th May 2010, 11:38
This takes me back. I remember doing this at University ten years ago... (everybody at the Halls of Residence was watching free Satellite Pay-TV)!

1. You create an EEPROM LOADER program for the PIC.

2. You then run that program to transfer your Data into the EEPROM.

3. You then load the PIC with your applications program.

The card is then programmed and ready to run. This was a three-stage process (if you got the card with a 16F8xx PIC, you could actually do it in one hit because it had the Program Codespace to embed your EEPROM Data into it, but that just wasn't possible with the F84 card).

MR2010
- 5th May 2010, 14:14
Thank you Melanie for helps, i know how to program it useing infinity or phonex programer that stoped 6years ago they were watchin tps and d+ and tv cabo sat channels over here but its gone early, well i just thought i can write a code for this bloody card so i can read and write its external eeprom useing pic16f628a,

Melanie
- 6th May 2010, 01:46
Just use something like Pheonix to put a simple Comms program into the F84 for PortB.7 (not PortB.0 as in your code at Post #2 above) to talk to your F628, then it's just dialogue between the two to determine what you want to do... ie put Data into the EEPROM, or read back/compare etc.

Start by simply sending ONE character from your F628, receiving it on the F84 card, and sending it back a few milliseconds later. Once you have managed reliable communications between the two, you can then build on that and add features.

MR2010
- 6th May 2010, 01:54
Just use something like Pheonix to put a simple Comms program into the F84 to talk to your F628. Then it's just dialogue between the two to determine what you want to do... ie put Data into the EEPROM, or read back/compare etc.
ok ty Melanie i will try this and see wat will happen,