Zanima me dali je neko imao priliku programirati neki eeprom preko navedenog mikrokontrolera , ukoliko jeste molio bi da mi se javi ili posalje kod i semu povezivanja na n3no_s@hotmail.com !
Hvala !
PIC 16f877a i eeprom 24c..
Moderators: pedja089, stojke369, [eDo], trax
Re: PIC 16f877a i eeprom 24c..
Koje veličine?nenoo wrote:Zanima me dali je neko imao priliku programirati neki eeprom preko navedenog mikrokontrolera
Driver nije potpuno isti za npr. 24c512 ili 24c16. Inače imaš drivere za njih napisane za emulatore pay-tv kartica (one strarije pogotovu; kao silvercard), za pic 16f877 ali i 16f84, nema neke razlike jer im je jezgra ista pa možeš iskoristiti bilo koji.
Posjeduju i rutine (emulatori) s makronaredbama za čitanje i upis u te memorije iz vanjskog uređaja ili PC-a. Izradom skripte možeš direktno manipulirati podacima u toj memoriji pomoću svog MCU-a.
Today's scientists have substituted mathematics for experiments, and they wander off through equation after equation, and eventually build a structure which has no relation to reality.
- Nikola Tesla
- Nikola Tesla
Re: PIC 16f877a i eeprom 24c..
Evo primjer jednog drivera za I2C memorije u assembleru za PIC MCU :
Definicije registara možete uraditi po vlastitoj želji.
Primjer:
LOWADR EQU 0X0F ; REGISTRY DEFINITION
HIADR EQU 0X10
SHIADR EQU 0X11
PODATAK EQU 0X19 ; PODAK ZA UPIS ILI PROCITANI IZ IC-a (DATA)
Code: Select all
;---------------------EXT EEPROM RUTINA -------------
I2CP1 BSF STATUS,RP0
BCF TRISA,0h ; SDL // PORTA,1== SCL
BCF STATUS,RP0
RETURN
;
I2CP2 BSF STATUS,RP0
BSF TRISA,0h ; ULAZNI FD SDA
BCF STATUS,RP0
RETURN
;
I2C13 CLRW ; THIS ROUTINE SHUD BE USED TO READ AND WRITE I2C MEM
BTFSC STATUS,C ; WHERE NEED TO BE DATA BASE FOR SUPORTED DEVICES
I2C15 IORLW 0x01 ; WHOLE ANSWERS TO PC PROM PROGRAMMER
IORLW 0xA0 ; AND OF COURSE BOOTLOADER FILES FOR 128 AND 163 MEGA CARDS/MCUs
I2C17 MOVWF 0x20
CALL I2CP1 ; I STOP HERE COSE PRIMARY INTENTION WAS TO MAKE FOR
MOVLW 0xF8 ; MYSELF SIMPLE PROGRAMMER FOR PROGRAMMING ATMEGA128
I2C1B RLF 0x20,F ; FOR MY MAIN PROJECT PROGRAMMER..........
CALL I2C2C
I2C1D ADDLW 0x01
BTFSS STATUS,Z
GOTO I2C1B
GOTO I2C31
I2C21 CALL I2CP2 ; PORTA 0== ULAZNI(SDL) PORTA1==IZLAZNI(SCL)
I2C23 MOVLW 0xF8
I2C24 CALL I2C33
I2C25 RLF 0x20,F
ADDLW 0x01
BTFSS STATUS,Z
GOTO I2C24
I2C29 RETURN
;
I2C2A CALL I2CP1
I2C2C BSF PORTA,0h
BTFSS STATUS,C
I2C2E BCF PORTA,0h
BSF PORTA,1h
GOTO I2C48
I2C31 CALL I2CP2
I2C33 BSF PORTA,1h
NOP
BSF STATUS,C
BTFSS PORTA,0h
BCF STATUS,C
GOTO I2C48
I2C39 BSF PORTA,0h
CALL I2CP1
I2C3C NOP
BSF PORTA,1h
NOP
BCF PORTA,0h
GOTO I2C48
I2C41 BCF PORTA,0h
CALL I2CP1
NOP
BSF PORTA,1h
NOP
BSF PORTA,0h
I2C48 NOP
BCF PORTA,1h ; SCL
RETURN
;
I2C4B ; MOVWF 0x21 ; LOADR
I2C4C CALL I2C39
BCF STATUS,C
CALL I2C13
BTFSC STATUS,C
GOTO I2C4C
MOVF HIADR,W ; HIADR
;ANDLW 0x7F ;; LIMIT ZA 8K HI ADR
CALL I2C17
MOVF LOWADR,W ;; LOW ADR I2C EEP
GOTO I2C17
I2CRD CALL I2C4C ; 56//CITANJE EXT EEPROMA BIO 4B
I2C57 CALL I2C39
BSF STATUS,C
CALL I2C13
I2C5A CALL I2C21
BSF STATUS,C
I2C5C CALL I2C2A
CALL I2C41
MOVF 0x20,W ;; DATA REG
RETURN
;
I2CWR CALL I2C4C
I2C7B CALL I2C57
; XORWF INDF,W
; BTFSC STATUS,Z
;GOTO I2C7A
I2C7F CALL I2C4C
I2C7D MOVF INDF,W ; SEQUENC MOD
CALL I2C17
I2C7A INCF FSR,F
;INCF LOWADR,F ; TU CE MOZDA TREBAT DODAT I UVECANJE HIADR
DECFSZ LOOP3,F
GOTO I2C7D
GOTO I2C41
RETURN
;
I2CSET MOVF LEN,W ; UPIS // PRIPREMA REG
I2CSER MOVWF LOOP3
MOVLW 0X2F
MOVWF FSR
RETURN
;
I2CWRX CALL I2CSET
CALL I2CWR
GOTO POCETAK
;
I2CRDX MOVLW 0X20
CALL I2CSER
I2CBF CALL I2CRD
MOVWF INDF
INCF FSR,F
INCF LOWADR,F
DECFSZ LOOP3,F
GOTO I2CBF
CALL SEND32
GOTO POCETAK
;
END
Primjer:
LOWADR EQU 0X0F ; REGISTRY DEFINITION
HIADR EQU 0X10
SHIADR EQU 0X11
PODATAK EQU 0X19 ; PODAK ZA UPIS ILI PROCITANI IZ IC-a (DATA)
Today's scientists have substituted mathematics for experiments, and they wander off through equation after equation, and eventually build a structure which has no relation to reality.
- Nikola Tesla
- Nikola Tesla