|
|
View previous topic :: View next topic |
Author |
Message |
everybird Guest
|
eeprom on 18f258 |
Posted: Sat Mar 01, 2003 4:24 pm |
|
|
How do I program the eeprom on a 18f258?? On the 16f series, it was
#pragma rom 0x2100 = {0,1,0,0 } etc
to write to it when flash programing,
How do I do this on the 18fxx2 ??
Thanks in advance for your time.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12261 |
|
|
R.J.Hamlett Guest
|
Re: eeprom on 18f258 |
Posted: Sun Mar 02, 2003 3:06 am |
|
|
:=How do I program the eeprom on a 18f258?? On the 16f series, it was
:=#pragma rom 0x2100 = {0,1,0,0 } etc
:=
:=to write to it when flash programing,
:=
:=How do I do this on the 18fxx2 ??
:=
:=Thanks in advance for your time.
The address is documented in the programming data sheet for the chip. It is 0xF00000 on the 18f chips.
You will have a further problem, with handling the change between the chips here. On the 16F, the addresses each held a 14bit word (potentially), and single bytes can be read as successive locations. On the 18F, the addresses store 16bit values, and the bytes are read in the order LSB,MSB from each location. Hence to store the 0,1,0,0 you show above to be readable in successive byte reads, requires:
#ROM 0xF00000 = { 0x100,0x0 }
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 12271 |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: eeprom on 18f258 |
Posted: Sun Mar 02, 2003 1:46 pm |
|
|
:=How do I program the eeprom on a 18f258?? On the 16f series, it was
:=#pragma rom 0x2100 = {0,1,0,0 } etc
:=
:=to write to it when flash programing,
:=
:=How do I do this on the 18fxx2 ??
:=
:=Thanks in advance for your time.
This is how I do it. One byte at a time. This is one of those things that should be mentioned in the manual.
#rom int8 0xF00000 = { 0b00010001 } //EEPROM byte 0
#rom int8 0xF00001 = { 0b00010000 } //EEPROM byte 1
#rom int8 0xF00002 = { 0b01000000 } //EEPROM byte 2
___________________________
This message was ported from CCS's old forum
Original Post ID: 12279 |
|
|
Tomi Guest
|
Re: eeprom on 18f258 |
Posted: Mon Mar 03, 2003 10:58 am |
|
|
It is depended on the reading implementation of any hex file of your programmer. With my own programmer (and of course my Win program) I know that the "implementation" of code and data are differential, so I can use without any problem:
#ROM 0xF00000 = {0x01,0x02,etc.}
even can use with later versions:
#ROM 0xF00000 = {"This is a data EEPROM string"};
Note that I felt myself so stupid to build a non-standard programmer... :)
:=:=How do I program the eeprom on a 18f258?? On the 16f series, it was
:=:=#pragma rom 0x2100 = {0,1,0,0 } etc
:=:=
:=:=to write to it when flash programing,
:=:=
:=:=How do I do this on the 18fxx2 ??
:=:=
:=:=Thanks in advance for your time.
:=
:=This is how I do it. One byte at a time. This is one of those things that should be mentioned in the manual.
:=
:=#rom int8 0xF00000 = { 0b00010001 } //EEPROM byte 0
:=#rom int8 0xF00001 = { 0b00010000 } //EEPROM byte 1
:=#rom int8 0xF00002 = { 0b01000000 } //EEPROM byte 2
___________________________
This message was ported from CCS's old forum
Original Post ID: 12307 |
|
|
PIC18F258 Guest
|
My Hellp!! |
Posted: Mon Jul 16, 2007 2:42 pm |
|
|
Portugues >> Brasil
Alguem pode me ajudar estou com um problema, com o pic 18f258,
estou querendo liagr um LED mais não consigo ter como comprovar se meu codigo esta correto alguem pode me ajudar nisso Este código esta correto.
#include <p18f258.h>
#include <delays.h>
#define LED PORTCbits.RC5
void main()
{
TRISC = 0;
LATC = 1;
LED = 1;
while(1)
{
Delay10KTCYx(10);
LED = !LED;
Delay10KTCYx(10);
}
} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Deivison Guest
|
PIC18F258 |
Posted: Wed Jul 18, 2007 10:57 am |
|
|
Brasil POrtugues!
Bom Dia Meu amigo tendo visto que você tem um grande conhecimento, perante a utilização de PIC, venho aqui para lhe pedir que se puder me ajudar por favor o faça. o meu problema e o seguinte.
Estou hoje programando em um PIC18F258, estou tendo dificuldades com ele pois tudo o que eu fiz ate hoje não deu certo!
Eu já não sei mais a quem recorrer muito obrigada pela paciência!
******************************o primeiro código foi esse*************************************** ******************************o primeiro código foi esse*************************************** ******************************o primeiro código foi esse*************************************** ******************************o primeiro código foi esse*************************************** ******************************o primeiro código foi esse***************************************
#include <p18f258.h>
#define LED PORTCbits.RC5 // Renome ando as portas do PIC
void main()
{
TRISC = 0; // Determina todo o PORTB como saída
LATC = 1; // Lê as informações do PORTB
LED = 1;
while(1)
{
LED = !LED;
}
}
******************************o segundo código foi esse*************************************** ******************************o segundo código foi esse*************************************** ******************************o segundo código foi esse*************************************** ******************************o segundo código foi esse*************************************** ******************************o segundo código foi esse*************************************** ******************************o segundo código foi esse***************************************
#include <p18f258.h>
#pragma config OSC = XT //Configuração do oscilador tipo XT
#define C PORTCbits.RC0 //Renome ando as portas do PIC
#define C1 PORTCbits.RC1
#define C2 PORTCbits.RC2
#define C3 PORTCbits.RC3
#define C4 PORTCbits.RC4
#define C5 PORTCbits.RC5
#define c6 PORTCbits.RC6
#define C7 PORTCbits.RC7
#define B PORTBbits.RB0
#define B1 PORTBbits.RB1
#define B2 PORTBbits.RB2
#define B3 PORTBbits.RB3
#define B4 PORTBbits.RB4
#define B5 PORTBbits.RB5
#define B6 PORTBbits.RB6
#define B7 PORTBbits.RB7
#define A PORTAbits.RA0
#define A1 PORTAbits.RA1
#define A2 PORTAbits.RA2
#define A3 PORTAbits.RA3
#define A4 PORTAbits.RA4
#define A5 PORTAbits.RA5
void wait() // tem a função de causar uma pequena interrupção
{
int x;
x = 20000;
for (;x>0; x--);
}
void pause() // tem a função de causar uma pequena interrupção
{
int x;
x = 20000;
for(;x>0; x--){
B = 1; // determina esta porta para liberar uma corrente
}
wait();
int x;
x = 20000;
for(;x>0; x--){
B = 0; // determina esta porta para bloquear uma corrente
}
}
void main()
{
TRISB = 0; // Determina todo o PORTB como saída
LATB= 0; // Lê as informações do PORTB
TRISA = 0xFF; // Determina como entrada
LATA= 1; // Lê a entrada
TRISC = 0xFF;
LATB= 1;
while(1)
{
C = 1;
C1 = 1;
C2 = 1;
C3 = 1;
C4 = 1;
C5 = 1;
C6 = 1;
C7 = 1;
B = 1;
if(PORTAbits.RA0)
{
B = 1;
}
else
{
pause(); // tem a função de causar uma pequena interrupção
B = 0;// acende uma determinada porta RB0
wait(); // tem a função de causar uma pequena interrupção
pause(); // tem a função de causar uma pequena interrupção
}
B1 = 1;
B2 = 1;
B3 = 1;
B4 = 1;
B5 = 1;
B6 = 1;
B7 = 1;
A = 1;
A1 =1;
A2 = 1;
A3 = 1;
A4 = 1;
A5 = 1;
}
} |
|
|
Bill Boucher
Joined: 04 Feb 2005 Posts: 34 Location: Chatham,ON,CA
|
Re: eeprom on 18f258 |
Posted: Wed Jul 18, 2007 7:13 pm |
|
|
everybird wrote: | How do I program the eeprom on a 18f258?? On the 16f series, it was
#pragma rom 0x2100 = {0,1,0,0 } etc
to write to it when flash programing,
How do I do this on the 18fxx2 ??
Thanks in advance for your time.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12261 |
Dude, you can still put the default eeprom values into your C source using the #ROM directive. Do it like this...
Code: |
// The following initializes the locations of the data EEPROM
// using the #ROM directive
#if defined (__PCM__)
#rom 0x2100={30,0,0x58,0x02,0x20,0x1C,50,0,0xEC,0,8,0,50,0,248,0,38,0,0x58,0x02,0,0}
#elif defined(__PCH__)
#rom int 0xf00000={30,0,0x58,0x02,0x20,0x1C,50,0,0xEC,0,8,0,50,0,248,0,38,0,0x58,0x02,0,0}
#endif
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 18, 2007 8:15 pm |
|
|
He's not using CCS. He's using the Microchip C18 compiler.
#rom doesn't work.
Here is my answer to him in Portuguese:
Este forum é para o compilador de CCS, não compilador C18.
Use por favor o forum do microchip C18.
http://forum.microchip.com/tt.aspx?forumid=3 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|