ynos0104
Newbie level 6
- Joined
- Sep 12, 2012
- Messages
- 14
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,432
Hi Everyone,
I am new to microcontrollers and by following some online tutorials I was able to make an embedded webserver using ATmega328-pu and ENC28J60 chips. The webserver is working fine with a basic passcode authentication.
My problem now is I want the user to be able to change the passcode. Currently the passcode is hardcoded in the system. I search google and found out that I can use EEPROM as a storage for the new passcode.
I also found some basic tutorial using EEPROM but for some reasons it is not working well for me.
Here are some of the codes that I used:
I am replacing the value of newpass to mypass from eeprom but for some reason this is not working for me. I would appreciate any help.
Also, it is not clear to me where in the uC the codes (c language --> hex) are being saved. Is it also saved in the eeprom?
Thanks.
I am new to microcontrollers and by following some online tutorials I was able to make an embedded webserver using ATmega328-pu and ENC28J60 chips. The webserver is working fine with a basic passcode authentication.
My problem now is I want the user to be able to change the passcode. Currently the passcode is hardcoded in the system. I search google and found out that I can use EEPROM as a storage for the new passcode.
I also found some basic tutorial using EEPROM but for some reasons it is not working well for me.
Here are some of the codes that I used:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 uint16_t EEMEM e_newpass[10]; //eeprom variable static char mypass[10] = "secret"; //default passcode //inside main() char newpass[10] = "test"; //write to eeprom eeprom_write_block((void *)newpass,(void *)&e_newpass,sizeof(newpass)); //read from eeprom eeprom_read_block((void *)mypass,(void*)&e_newpass,sizeof(mypass)); //code for webserver and simple authentication below...
I am replacing the value of newpass to mypass from eeprom but for some reason this is not working for me. I would appreciate any help.
Also, it is not clear to me where in the uC the codes (c language --> hex) are being saved. Is it also saved in the eeprom?
Thanks.