Hi, before I change to my desired pins, I made a test(using the original code)...but gives me this "Init: 6 1 255". I don't understand the code I used for testing works before.
Do you know what's causing it?
regards,
tacbanon
Hi, before I change to my desired pins, I made a test(using the original code)...but gives me this "Init: 6 1 255". I don't understand the code I used for testing works before.
Do you know what's causing it?
regards,
tacbanon
Open the SDFS file and look at the CE_xxx .
Your card did not initialize. Could be lots of things from a loose wire to a bad card. Bad as in file format corrupt to just wore out.
If the connections are good see if the card can be read in a PC, check the format.
Dave
Always wear safety glasses while programming.
Oh my, I think I broke my sdcard module. I double checked the wires I'm using and I reconnect and disconnect them to the devboard more than 10 times still the same result. The SDCard is okay (its in FAT format). I remembered I connect it to PortB earlier the same port where the keypad is also connected.this could have ruin the module...
For the mean time while I'm waiting for my new sdcard module(will come within a week). I will try to study on eeprom(Pic18F4550's internal). Thank you again to this wonderful forum(people) and to macrackit for the precious time... until nextime.
regards,
tacbanon
Hi, I've been playing some time with READ and Write command on the internal eeprom, I'm having trouble updating DATA @6,5,"54321". Probably I'm doing it the hard way. Can you help me out what I'm doing wrong?
But updating Data @0 ,"12345" was not a problem, I'm stuck passed @0 location.Code:'My Tested Prototype with Pic18F4550 and EEPROMInclude "modedefs.bas" INCLUDE "C:\PBP\USB18\EE_Vars.pbp" ; Include the EE_var routines asm __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_2_2L & _VREGEN_ON_2L __CONFIG _CONFIG2H, _WDT_OFF_2H __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L endasm DEFINE OSC 48 ADCON1 = 15 ' Set all I/Os to Digital CMCON = 7 ' Disable Comparators INTCON2.7 = 0 'EEprom data 'U1 VAR WORD : @ EE_var _U1, WORD, 9999 ' for later use DATA @0,5,"12345" DATA @6,5,"54321" DATA @13,5,"14332" DATA @19,5,"24432" DATA @25,5,"85921" TRISA = %00000000 TRISD = %00000000 PORTD = %00000000 TRISB = %11110000 ' Set Keypad I/O PORTB = 0 ' Set columns LOW PortA = 0 myvarkey var byte ByteA var Byte[6] B0 var byte[5] cnt var byte x var byte cnt = 0 asciichar var byte address var byte ' ---------------------------------[Program Start]---------------------------------------------- serout2 PortD.5,T9600,[$1B,$63,$30] pause 200 serout2 PortD.5,84,[$1B,$45,"EEPROM"] serout2 PortD.5,84,[$D,"Studies"] serout2 PortD.5,84,[$1B,$63,$30] pause 2000 Serout2 PortD.5,84, [$1B,$45] main: @ READKEYPAD _myvarkey lookup myvarkey,[0,"123A456B789C*0#D"],Key Serout2 PortD.5,84, [$1B,$45,"Key = ",Key] if Key = "#" and cnt < 6 then if ByteA[0]="1" and ByteA[1]="9" then ' wait 19 is pressed before updating Serout2 PortD.5,84, [$D, "Special Key"] pause 20 serout2 PortD.5,84,[$D,str ByteA\cnt] READ 6,x for address=6 to x+6 Write address+1, ByteA[address] next address cnt=0 endif else ByteA[cnt]=Key Serout2 PortD.5,84, [$D, ">" , ByteA[cnt]] cnt=cnt+1 Endif if cnt > 5 then Serout2 PortD.5,84, [$D, "5Digits only"] cnt = 0 ENdif if Key = "A" then READ 0,x serout2 PortD.5,84,[$D,Dec x," "] pause 1000 for address=0 to x READ address,asciichar serout2 PortD.5,84,[$D,asciichar] next address pause 1000 cnt = 0 endif if Key = "B" then READ 6,x serout2 PortD.5,84,[$D,Dec x," "] pause 1000 for address=0+6 to x+6 READ address,asciichar serout2 PortD.5,84,[$D,asciichar] next address pause 1000 cnt = 0 endif if Key = "C" then READ 13,x serout2 PortD.5,84,[$D,Dec x," "] pause 1000 for address=0+13 to x+13 READ address,asciichar serout2 PortD.5,84,[$D,asciichar] next address pause 1000 cnt = 0 endif if Key = "D" then READ 19,x serout2 PortD.5,84,[$D,Dec x," "] pause 1000 for address=0+19 to x +19 READ address,asciichar serout2 PortD.5,84,[$D,asciichar] next address pause 1000 cnt = 0 endif if Key = "*" then READ 25,x serout2 PortD.5,84,[$D,Dec x," "] pause 1000 for address=0+25 to x +25 READ address,asciichar serout2 PortD.5,84,[$D,asciichar] next address pause 1000 cnt = 0 endif pause 500 goto main
regards,
tacbanon
This:
produces this when the EEPROM is read backCode:DATA @0,"12345" DATA @6,"54321"
31 32 33 34 35 00 35 34 33 32 31 00 FF FF
Is that what you want?
Did you find out what went bad with the SD card module? You can always use the SD card socket without all the other stuff on the module, it is easy if the MCU is running ~3 volts.
Dave
Always wear safety glasses while programming.
Sorry If I was not being clear... how can I rewrite them and read back as in the format of "56988" or "65431".Code:DATA @0,"12345" DATA @6,"54321"
Before overwriting DATA @6,"54321" I can read back as "54321". But after updating it gives me like Hex numbers.
I don't know exactly what happened to sdcard it just dont work as before. But I will try to test it again later.
thanks,
tacbanon
Hi mackrackit, sorry if was not making clear. I want to read back from eeprom in the format of example "12345" or "65432" and I can do this uisng the following code.
And I noticed that if I rewrite the value of DATA @6,5,"54321" by entering "19325" and read it back I get "QZu" not "19325"..how do I resolve this?Code:if Key = "A" then READ 0,x serout2 PortD.5,84,[$D,Dec x," "] pause 1000 for address=0 to x READ address,asciichar serout2 PortD.5,84,[$D,asciichar] next address pause 1000 cnt = 0 endif
I will try to test the sdcard tonight, hope something comes up....
thanks,
tacbanon
Last edited by tacbanon; - 2nd November 2011 at 12:59.
Bookmarks