CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Same C program but PCM and PCW output differently

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
water_river



Joined: 17 Feb 2004
Posts: 16

View user's profile Send private message

Same C program but PCM and PCW output differently
PostPosted: Tue Feb 24, 2004 9:54 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 25, 2004 1:26 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 25, 2004 3:59 am     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Wed Feb 25, 2004 4:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 25, 2004 7:08 pm     Reply with quote

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??
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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