View Full Version : I have a problem with read from internal eprom
don_mathew
- 10th September 2006, 20:44
im programming PIC 16f84a using pic basic pro
i have 8 LEDs conected to the PORTB from 0 to 7...
here is a problem...
READ 0 , b 'on eprom location 0 is $AA
PORTB = b
its not working but this
b = $AA
PORTB = b
is working...
so what can i do to get this way working
READ 0,b
PORTB = B.......
maus
- 10th September 2006, 21:39
how do you know adres 0 is filled with $AA ?
do this
write 0,$AA
then the rest will work
mister_e
- 10th September 2006, 22:54
if you used DATA to store your stuff, be sure your device programmer fill the internal EEPROM. Some device programmer software have the ability to enable/disable the EEPROM write to prevent loosing previous precious data.
sayzer
- 11th September 2006, 08:00
....
its not working but this
b = $AA
PORTB = b
is working...
so what can i do to get this way working
READ 0,b
PORTB = B.......
Once you store initial values into your eeprom then
you can also do this:
READ 0, PORTB
----------------
don_mathew
- 21st September 2006, 17:46
reading from eprom is working but when i try to read 15address location and save them one by one in array its not working...this example is not working can enybody tell me what is wrong in this code...on PIC simulator IDE v6.34 on
var led[15] led board gives me sign on PORTB $0F instead $FF
define OSC 8
TRISB = $00
PORTB = $00
i var byte
led var byte [15]
led[0] = %00000001
led[1] = %00000010
led[2] = %00000100
led[3] = %00001000
led[4] = %00010000
led[5] = %00100000
led[6] = %01000000
led[7] = %10000000
led[8] = %10000001
led[9] = %10000010
led[10] = %10000100
led[11] = %10001000
led[12] = %10010000
led[13] = %10100000
led[14] = %11000000
led[15] = %11111111
loop:
for i = 0 to 15
PORTB = led[i]
Next i
goto loop
PIC16F84A
don_mathew
- 21st September 2006, 18:11
i found the problem...
i'm c++ programmer and when u define array like this
int var[15]
that means var from 0 to 15 and thats 16 memory addresses
and in pic basic
led var byte [15] means from 0 to 14...i hope that this post will help someone...
ErnieM
- 21st September 2006, 18:11
led var byte [15]
That's your problem, you defined a 15 byte array and are trying to address the 16th element.
led var byte [15] ' defines a 15 byte array addressed 0 to 14
Change the 15 to a 16 and all should work.
peterdeco1
- 21st September 2006, 18:36
If you define a 16 byte variable, is it the same thing as defining a word variable?
mister_e
- 22nd September 2006, 00:48
NOPE
16 BITS will be a WORD.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.