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

Re: This program works on PCW 2 but not PCML 3

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







This program works on PCW 2 but not PCML 3
PostPosted: Tue Nov 06, 2001 7:31 pm     Reply with quote

Has anyone experienced problems with PCML 3.055? I have
the following program:

#include "devices/16f877.h"
#include "drivers/stdio.h"
#fuses NOWDT,HS,NOPROTECT
#use delay(clock=20000000)
#use fast_io(E)

int8 pe;
#byte pe=0x09

main()
{
set_tris_e(0x00);
output_high(PIN_E0); // oops i should have
// taken this out before
while (1)
{
pe=0;
delay_ms(1000);
pe=0x07;
delay_ms(1000);
}
}

This blinks the 3 LED's attached to pins RE1-3 on and off... that is, when I compile it with PCW 2. If I compile the exact same program in PCML (linux) 3.055 and burn the same HEX file into the PIC chip, it doesn't work.

I have tried converting the HEX file to ms-dos text format with unix2dos before sending it to the Windows box and it changes the HEX printout in PICwriter but makes no difference as far as functionality is concerned. I am loading the hex file into PICWriter 1.1 and using a Parallax PIC programmer to burn the code into the chip on a separate Windows box, even though I am compiling on Linux.

Here are the hex files:

<a href="http://max.jrd.com/ledtest-good.hex">ledtest-good.hex</a>
<a href="http://max.jrd.com/ledtest-good.lst">ledtest-good.lst</a>
<a href="http://max.jrd.com/ledtest-bad.hex">ledtest-bad.hex</a>
<a href="http://max.jrd.com/ledtest-bad.lst">ledtest-bad.lst</a>

Thanks,
Justin Dobbs
Glacier Bay, Inc.
___________________________
This message was ported from CCS's old forum
Original Post ID: 991
Tomi
Guest







Re: This program works on PCW 2 but not PCML 3
PostPosted: Wed Nov 07, 2001 12:12 pm     Reply with quote

<font face="Courier New" size=-1>I don't have PCML but I took a short look on your list files and I have seen 3 differences. Any of these diffs is enough to lack your program:
1. The delay_ function is only a RETURN instead of the delay loops:
.................... #use delay(clock=20000000)
0004: RETLW 00
2. The PIC initialisation at the start of the main() is completely missing:
.................... main()
.................... {
.................... set_tris_e(0x00);
0005: MOVLW 00
3. At your delay_ms(1000) call at least two lines are missing:
0009: MOVLW FA
000A: MOVWF 22
000B: CALL 004
The right code:
0038: MOVLW 04
0039: MOVWF 21
003A: MOVLW FA
003B: MOVWF 22
003C: CALL 004
003D: DECFSZ 21,F
003E: GOTO 03A
Additionally Linux version uses a strange kind of bit addressing but it could be O.K.:
.................... set_tris_e(0x00);
0005: MOVLW 00
0006: BSF 03.5 // points instead of the colon
0007: MOVWF 09
0008: BCF 03.5
Report your bugs to CCS.

:=Has anyone experienced problems with PCML 3.055? I have
:=the following program:
:=
:=#include "devices/16f877.h"
:=#include "drivers/stdio.h"
:=#fuses NOWDT,HS,NOPROTECT
:=#use delay(clock=20000000)
:=#use fast_io(E)
:=
:=int8 pe;
:=#byte pe=0x09
:=
:=main()
:={
:= set_tris_e(0x00);
:= output_high(PIN_E0); // oops i should have
:= // taken this out before
:= while (1)
:= {
:= pe=0;
:= delay_ms(1000);
:= pe=0x07;
:= delay_ms(1000);
:= }
:=}
:=
:=This blinks the 3 LED's attached to pins RE1-3 on and off... that is, when I compile it with PCW 2. If I compile the exact same program in PCML (linux) 3.055 and burn the same HEX file into the PIC chip, it doesn't work.
:=
:=I have tried converting the HEX file to ms-dos text format with unix2dos before sending it to the Windows box and it changes the HEX printout in PICwriter but makes no difference as far as functionality is concerned. I am loading the hex file into PICWriter 1.1 and using a Parallax PIC programmer to burn the code into the chip on a separate Windows box, even though I am compiling on Linux.
:=
:=Here are the hex files:
:=
:=<a href="http://max.jrd.com/ledtest-good.hex">ledtest-good.hex</a>
:=<a href="http://max.jrd.com/ledtest-good.lst">ledtest-good.lst</a>
:=<a href="http://max.jrd.com/ledtest-bad.hex">ledtest-bad.hex</a>
:=<a href="http://max.jrd.com/ledtest-bad.lst">ledtest-bad.lst</a>
:=
:=Thanks,
:=Justin Dobbs
:=Glacier Bay, Inc.</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 1001
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