View previous topic :: View next topic |
Author |
Message |
water_river
Joined: 17 Feb 2004 Posts: 16
|
Same C program but PCM and PCW output differently |
Posted: Tue Feb 24, 2004 9:54 pm |
|
|
hi, all,
I am using PCM and PCW to compile the same program but have different outputs.
With the C program:
//
#include <16f877.h>
#use delay (clock=20000000)
#fuses HS, NOWDT, PUT, NOBROWNOUT, NOLVP, PROTECT
void main(){
//set_tris_b(0x00);
while(true)
output_b(0b11111111);
}
//
using two CCS compiler to program, I view the program memory and find it written differently:
in the case of using PCM:
MOVLW 0
MOVWF 0xa
GOTO 0x4
NOP
CLRF 0x4
MOVLW 0x1f
ANDWF 0x3, F
MOVLW 0x9f
MOVWF 0x4
MOVLW 0x7
MOVWF 0
MOVLW 0
BSF 0x3, 0x5
MOVWF 0x6
MOVLW 0xff
BCF 0x3, 0x5
MOVWF 0x6
GOTO 0xb
SLEEP
ADDLW 0xff
...
INCF 0, W (end memory)
in the case of using PCW (v3.094):
MOVLW 0
MOVWF 0xa
GOTO 0x4
NOP
CLRF 0x4
MOVLW 0x1f
ANDWF 0x3, F
MOVLW 0xf
BSF 0x3, 0x5
ADDLW 0x9f
ADDLW 0xff
...
Obviously, the one done by PCW does not work.
Do anyone know why?? Thanks in advance |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 25, 2004 1:26 am |
|
|
The code from PCM makes sense. You can see that near the end,
it's setting the TRISB register to be all outputs, and then it's
setting all the PortB pins to logic 1's.
The 2nd code doesn't make sense near the end. The instructions
aren't correct. Did you cut part of it off ? Did you cut and paste
that code into your post ? If that's the real code, then your version
of PCW may have a problem. |
|
|
water_river
Joined: 17 Feb 2004 Posts: 16
|
|
Posted: Wed Feb 25, 2004 3:59 am |
|
|
I did copy and paste, but I also noticed that in the end of the memory, it is written that "ADDLW 0xff ". Not only that, but also in the PCW's program memory, the processor never touches the PORTB register.
My PCW version is 3.094. When I installed, in the end of the installation, it was trying to find "MPLAB.ini" file, which MPLAB6.40 doesn't have.
Can anyone tell me whether there is some MPLAB or PCW setting specifications that I may not notice??Thanks |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Wed Feb 25, 2004 4:49 am |
|
|
I/O on any port with 3077 PCH for the 18xxxx parts did not work.
I/O worked with PCM for the 16xxxx parts
PCH may not have been fixed by 3094. |
|
|
water_river
Joined: 17 Feb 2004 Posts: 16
|
|
Posted: Wed Feb 25, 2004 7:08 pm |
|
|
hi, Douglas,
Thanks a lot for your reply. Could you please explain in more details, as I don't understand it very well?? Do you mean PCW v3.094 cannot be used to do any I/O function for 16xxx or 18xxxx?? |
|
|
|