Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
williB said:i just stored the array as a shortint. it worked !
so i assume that each one or zero is stored as a byte..?
i'm not sure how it is stored..?Nigel Goodwin said:williB said:i just stored the array as a shortint. it worked !
so i assume that each one or zero is stored as a byte..?
It depends entirely on how and where you store it - if you're storing each individual BIT in it's own variable, that seems very clumsy and wasteful. As the value is a 14 bit WORD, it makes sense to store them as such, in an unsigned 16 bit WORD variable - ignoring the top two bits, although they come into play if you start using 18F series 16 bit PIC's.
williB said:i'm not sure how it is stored..?
this is my statement..under type
PicoutType = array[0..1024,1..14] of shortint;
i think , but not sure , that each bit is stored as a shortint..
BufType = Record
Prog : Array[0..MaxProgSize - 1] Of Word;
Data : Array[0..MaxDataSize - 1] Of Word;
ID : Array[0..7] Of Word;
Fuses : Word;
Config : Array[1..7] Of Word;
End;
williB said:Thanks for that Nigel
i have another question i checked your site ,but didnt see anything on hardware interrupts..
ok using PIC 16F628A
i plan on using RB0 / int pin and i am not sure how to do it..
i just need an outline of what to do..
My interrupt will be normally high , going low when the interrupt occors.
1)i know you have to clear the Intedg ,bit 6 in option reg..
2)as for the INTCON reg ..?
i think all i have to do for this is set bit 4 INTE and clear bit 1 INTF after i service the interrupt..
3)i think i also have to save W and STATUS and return them when done..but i am not sure why STATUS must be saved .?
org 0x00
goto BEGIN
org 0x04 ;set start of ISR
movwf wtemp ; save W & status
swapf STATUS,W
movwf statustemp
movlw 0x0E ;blink upper three of lower half ON
movwf PORTB
nop
nop
nop
movlw 0x00 ; Blink OFF
movwf PORTB
movlw 0x0E ;blink upper three of lower half ON
movwf PORTB
nop
nop
nop
movlw 0x00 ; Blink OFF
movwf PORTB
swapf statustemp,W ; Restore W & status
movwf STATUS
movf wtemp,w
bcf INTCON,1 ; clear bit 1 INTF
retfie
BEGIN clrf PORTA
clrf PORTB
bsf INTCON,4 ; Enable RB0 interrupt
movlw 0x07 ; turn off comparators
movwf CMCON
bsf INTCON,7 ; Bit7 GIE global int enable
bsf INTCON,6 ; PEIE Bit set Peripheral enable
bsf INTCON,4 ; INTE Bit RB0 External Interrupt bit
bsf STATUS ,RP0 ;Bank 1
;set TRISB bit0 to 1
movlw b'00000001' ;set PORTB Bits<7..1>as output
movwf TRISB ; PORTB Bit0 as Input
bcf OPTION_REG,6 ;Clear PEIE (RBO interrupt)
bcf STATUS ,RP0 ; Bank 0
START
nop
nop
; wait for interrupt
nop
goto START
end
wtemp EQU 0x20
statustemp EQU 0x21
org 0x00
goto BEGIN
org 0x04 ;set start of ISR
movwf wtemp ; save W & status
swapf STATUS,W
movwf statustemp
clrf STATUS ; Force bank 0
clrf PORTA
clrf PORTB
; my blink routine starts here
movlw 0x0E ;blink upper three of lower half ON
movwf PORTB
nop
nop
nop
movf PORTB,w
movlw 0x00 ; Blink OFF
movwf PORTB
; my Blink routine stops here
swapf statustemp,w ; Restore W & status
movwf STATUS
movf wtemp,w
bcf INTCON,INTF ; clear bit 1 INTF
retfie
BEGIN
bsf STATUS,RP0 ; Bank 1
movlw 0x1F
movwf TRISA
movlw b'00000001' ;set PORTB Bits<7..1>as output
movwf TRISB ; PORTB Bit0 as Input
bcf STATUS,RP0 ; Bank 0
clrf PORTA
clrf PORTB
clrf INTCON
movlw 0x07 ; turn off comparators
movwf CMCON
bcf OPTION_REG,INTEDG ; Interrupt edge select bit
bsf INTCON,GIE ; Bit7 GIE global int enable
bsf INTCON,INTE ; bit 4 Enable RB0 interrupt
START
; wait for interrupt
goto START
end
techknow said:i need write an asm code for reading and writing to pic16f628 internal EEPROM so help me!! how it can be don
not enough so dont tr it againConsult my tutorials, one of the remote control ones does just that!.
techknow said:not enough so dont tr it againConsult my tutorials, one of the remote control ones does just that!.
techknow said:sorry for disturbing u guys
actualy i need is a asm code for w/r to a pic internal eeprom....not an complicated tiutorial....
please explain..techknow said:i need write an asm code for reading and writing to pic16f628 internal EEPROM so help me!! how it can be don