FranzW
Active Member
 
Offline
Posts: 182
Thank You
-Given: 589
-Receive: 81
|
 |
« on: April 14, 2012, 05:34:59 17:34 » |
|
Hello, Would somebody please help me to fix a problema I am having with EWrite of Proton? Please see the attached files. Regards, FranzW
|
|
|
Logged
|
|
|
|
Faros
Senior Member
  
Offline
Posts: 254
Thank You
-Given: 141
-Receive: 178
|
 |
« Reply #1 on: April 14, 2012, 06:22:59 18:22 » |
|
@FranzW
I didn't go through all of your code and your circuit; I have just checked for a common slip; writing to the Eprom takes 10ms to be completed so you need to insert a 10ms delay before you can issue an Eread command; this is PIC related specs (not Proton).
|
|
|
Logged
|
|
|
|
bbarney
Moderator
Hero Member
   
Offline
Posts: 2429
Thank You
-Given: 405
-Receive: 545
Uhm? where did pickit put my mute button
|
 |
« Reply #2 on: April 14, 2012, 06:31:02 18:31 » |
|
in your code you use a 16f628A as the device but your proteus file is using 16f84A
|
|
|
Logged
|
Ever wonder why Kamikaze pilot's wore helmet's ?
|
|
|
FranzW
Active Member
 
Offline
Posts: 182
Thank You
-Given: 589
-Receive: 81
|
 |
« Reply #3 on: April 14, 2012, 07:35:13 19:35 » |
|
in your code you use a 16f628A as the device but your proteus file is using 16f84A
Thanks. I was almost getting crazy. I firstly used the PF16F84, then I changed it for a PIC16F628A. I made the change in Proton, but forgot to do it in Isis. Regards, FranzW
|
|
|
Logged
|
|
|
|
Faros
Senior Member
  
Offline
Posts: 254
Thank You
-Given: 141
-Receive: 178
|
 |
« Reply #4 on: April 14, 2012, 08:19:22 20:19 » |
|
Still you will need to wait for 10ms till your fresh written byte is READABLE, as for the code commutability, most of the F84A codes will work on the 628A as long as you have avoided the last chip specific features.
|
|
|
Logged
|
|
|
|
bbarney
Moderator
Hero Member
   
Offline
Posts: 2429
Thank You
-Given: 405
-Receive: 545
Uhm? where did pickit put my mute button
|
 |
« Reply #5 on: April 14, 2012, 11:44:08 23:44 » |
|
That may be true when putting 16F84A code into the 16F628A but not the other way around for a complete list see here http://www.amqrp.org/elmer160/lessons/e160aa.pdfthis is probably the main reason Franz is having trouble Not all the registers in the ‘628 are at the same addresses as those in the ’84. The registers for addressing the EEPROM have changed banks! The EEIE bit has moved from the INTCON register to the PIE1 register. EEIF has moved from EECON1 to PIR1. These bits are used when writing to the EEPROM.
|
|
|
Logged
|
Ever wonder why Kamikaze pilot's wore helmet's ?
|
|
|
zuisti
Senior Member
  
Offline
Posts: 409
Thank You
-Given: 242
-Receive: 780
|
 |
« Reply #6 on: April 15, 2012, 01:29:50 13:29 » |
|
Hi FranzW; I do not understand your program exactly , but I see a serious problem:
Writing a word size constant (like 256 and greater) to the eeprom using the following command: EWrite 0, [256] causes a 2-byte eeprom writing at address 0: 00 01 and your command: Tiempo = ERead 0 results a wrong value: Tiempo will be 0 (in this case, and if this is a Byte var).
A possible work-around: use a word variable in the EWrite (instead of the constants) and also as Tiempo.
Other: The PIC16 internal EEPROM routines are not using the EEIE, EEIF bits but the EECON1.WR. This is cleared in hardware at completion of the write operation. The EWrite routine is waiting for it using a loop, so no one additional 10 ms waiting need (you can look it in the .LST output file).
|
|
« Last Edit: April 15, 2012, 01:46:04 13:46 by zuisti »
|
Logged
|
|
|
|
bbarney
Moderator
Hero Member
   
Offline
Posts: 2429
Thank You
-Given: 405
-Receive: 545
Uhm? where did pickit put my mute button
|
 |
« Reply #7 on: April 15, 2012, 02:33:46 14:33 » |
|
one last possible problem is In the 16F628, RA0, 1, 2, and 3 power up as part of comparators; the normal I/O behavior doesn’t work. In order to make these pins behave like a 16F84, the CMCON register needs to be initialized just add this after All_Digital=true CMCON=7 'turn off compartors ( MAKES SURE All_Digital=true )
|
|
|
Logged
|
Ever wonder why Kamikaze pilot's wore helmet's ?
|
|
|
bbarney
Moderator
Hero Member
   
Offline
Posts: 2429
Thank You
-Given: 405
-Receive: 545
Uhm? where did pickit put my mute button
|
 |
« Reply #8 on: April 16, 2012, 02:06:31 02:06 » |
|
Post all your Code problems for Proton beta Versions here instead of the Main Compiler thread
|
|
« Last Edit: April 16, 2012, 02:27:29 02:27 by bbarney »
|
Logged
|
Ever wonder why Kamikaze pilot's wore helmet's ?
|
|
|
zuisti
Senior Member
  
Offline
Posts: 409
Thank You
-Given: 242
-Receive: 780
|
 |
« Reply #9 on: December 23, 2012, 11:29:22 11:29 » |
|
Encountered an interesting problem ...
While I'm writing a new Proton program, the Proteus source-level debugging is often used. However, the now developed program could not debug so, because the source window simply not appeared in the Proteus. At the same time the compiling was successful and the program worked fine.
For a long time I was looking for, what causes this behavior (I tried the 3554, the 3551 and the 3535 version too), then I went back to the good old v3506, which worked fine.
Finally, quite by chance I found the cause:
If the program contains (anywhere) a label named f1 (note the lowercase !) like this: f1: LData "f1 is a wrong label !!", 13 then Proteus cannot display the source window, but the F1 (uppercase), f2, f3, a1, x1 are all working fine (!?!).
After examining the .LST files, I saw that the program generates such lines for debugging: F1_000011 equ $ ; IN [TEST.BAS] Set PORTB Perhaps this is the cause of this problem. But then why works with F1 ? I don't know...
This can be also explained this thing: An amendment made in version 3.5.1.7: Variables, labels and directives in the .LST and .ASM files now appear as they do in the BASIC listing, instead of being all uppercase.
At any rate, label f1 never use, this is a "reserved word"
zuisti
|
|
|
Logged
|
|
|
|
|