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

16F877 refusing to do anything

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







16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 3:46 am     Reply with quote

I'm trying to program a 16F877 using the Warp13 programmer and can't get any response out of the chip. I'm using the CCS compiler, and even the simplest program refuses to run. For example:

#include <16f877.h>
#use delay (clock=20000000)

main()
{
while(TRUE)
{
output_high(PIN_A2);
delay_ms(500);
output_low(PIN_A2);
delay_ms(500);
}
}

This compiles and programs just fine, but I'm not seeing any oscillation on the pin. As far as I can tell, my code's not even getting run.
Admittedly, a lot of pins on the PIC are floating because they're not used right now... don't know if that could be part of the problem.
I've also tried this on 3 or 4 MCUs, so I don't have a bad PIC.
Any help anyone could offer would make my day. Thanks!

~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1190
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 4:47 am     Reply with quote

Hi

Did you set the fuse options right in the programmer dialogue?
(try "picchips pic16f877" on the command prompt for available fuses or see the data sheet)

mfg
Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 1192
Frank
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 4:59 am     Reply with quote

The warp-13 defaults to “Force-ISP”. If you are not using the ISP you must uncheck it. See options in Warp-13

-Frank




:=I'm trying to program a 16F877 using the Warp13 programmer and can't get any response out of the chip. I'm using the CCS compiler, and even the simplest program refuses to run. For example:
:=
:=#include <16f877.h>
:=#use delay (clock=20000000)
:=
:=main()
:={
:= while(TRUE)
:= {
:= output_high(PIN_A2);
:= delay_ms(500);
:= output_low(PIN_A2);
:= delay_ms(500);
:= }
:=}
:=
:=This compiles and programs just fine, but I'm not seeing any oscillation on the pin. As far as I can tell, my code's not even getting run.
:=Admittedly, a lot of pins on the PIC are floating because they're not used right now... don't know if that could be part of the problem.
:=I've also tried this on 3 or 4 MCUs, so I don't have a bad PIC.
:=Any help anyone could offer would make my day. Thanks!
:=
:=~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1193
pha555
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 8:08 am     Reply with quote

Note that PORTA defaults to the A/D converter.

You might try your program on PORTB.

Peter H Anderson, <a href="http://www.phanderson.com" TARGET="_blank">http://www.phanderson.com</a>

:=I'm trying to program a 16F877 using the Warp13 programmer and can't get any response out of the chip. I'm using the CCS compiler, and even the simplest program refuses to run. For example:
:=
:=#include <16f877.h>
:=#use delay (clock=20000000)
:=
:=main()
:={
:= while(TRUE)
:= {
:= output_high(PIN_A2);
:= delay_ms(500);
:= output_low(PIN_A2);
:= delay_ms(500);
:= }
:=}
:=
:=This compiles and programs just fine, but I'm not seeing any oscillation on the pin. As far as I can tell, my code's not even getting run.
:=Admittedly, a lot of pins on the PIC are floating because they're not used right now... don't know if that could be part of the problem.
:=I've also tried this on 3 or 4 MCUs, so I don't have a bad PIC.
:=Any help anyone could offer would make my day. Thanks!
:=
:=~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1194
Dave Y.
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 8:50 am     Reply with quote

CCS defaults to A/D on port A. You have to turn this off if you are going to use the pins for digital input/output.

You have to add the line:
setup_adc(ADC_OFF);

This should fix it...

Dave


:=I'm trying to program a 16F877 using the Warp13 programmer and can't get any response out of the chip. I'm using the CCS compiler, and even the simplest program refuses to run. For example:
:=
:=#include <16f877.h>
:=#use delay (clock=20000000)
:=
:=main()
:={
:= while(TRUE)
:= {
:= output_high(PIN_A2);
:= delay_ms(500);
:= output_low(PIN_A2);
:= delay_ms(500);
:= }
:=}
:=
:=This compiles and programs just fine, but I'm not seeing any oscillation on the pin. As far as I can tell, my code's not even getting run.
:=Admittedly, a lot of pins on the PIC are floating because they're not used right now... don't know if that could be part of the problem.
:=I've also tried this on 3 or 4 MCUs, so I don't have a bad PIC.
:=Any help anyone could offer would make my day. Thanks!
:=
:=~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1196
Mark Haines
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 2:46 pm     Reply with quote

:=You have to add the line:
:= setup_adc(ADC_OFF);

I know we tried this at least once; we've also tried using PORTC instead, and, I believe PORTD.
We've tried a variety of sample programs and have gotten absolutely no indication that the PIC is doing anything whatsoever. All the pins are floating low except the oscillator output.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1202
Mark Haines
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 2:48 pm     Reply with quote

:=The warp-13 defaults to “Force-ISP”. If you are not using the ISP you must uncheck it. See options in Warp-13

What effect would this have exactly? The MCU programs and verifies just fine each time... It just doesn't run, apparently. I haven't yet had a chance to test turning off "Force-ISP", though... I'll keep you posted if that helps.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1203
Michael Langford
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 6:29 pm     Reply with quote

I am Mark's partner(the gentleman who originated this thread). I tried turning off that option this afternoon. Nothing changed. I actually rewrote the program into assembler, and it still doesn't do anything once its programed.

The assembler program sets all the ports to outputs, then sets the a/d to all digital. It uses the HS oscillator option, and no watchdog timer or brownout detect. Then it sets portc,2 to 1. This still doesn't do anything.

Could someone take some code that they have for the 16f877 that does work and uses the internal oscillator and post/mail the initalization section?

Or does anyone know of a simple program like that on the web that just sanity checks that you have the fuses set correctly and your programmer is actually programming?

--Michael

:=The warp-13 defaults to “Force-ISP”. If you are not using the ISP you must uncheck it. See options in Warp-13
:=
:=-Frank
:=
:=
:=
:=
:=:=I'm trying to program a 16F877 using the Warp13 programmer and can't get any response out of the chip. I'm using the CCS compiler, and even the simplest program refuses to run. For example:
:=:=
:=:=#include <16f877.h>
:=:=#use delay (clock=20000000)
:=:=
:=:=main()
:=:={
:=:= while(TRUE)
:=:= {
:=:= output_high(PIN_A2);
:=:= delay_ms(500);
:=:= output_low(PIN_A2);
:=:= delay_ms(500);
:=:= }
:=:=}
:=:=
:=:=This compiles and programs just fine, but I'm not seeing any oscillation on the pin. As far as I can tell, my code's not even getting run.
:=:=Admittedly, a lot of pins on the PIC are floating because they're not used right now... don't know if that could be part of the problem.
:=:=I've also tried this on 3 or 4 MCUs, so I don't have a bad PIC.
:=:=Any help anyone could offer would make my day. Thanks!
:=:=
:=:=~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1208
Dave Y.
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 6:35 pm     Reply with quote

I tried this program exactly as you posted it and it works for me using my Warp13 programmer. I also tried it with my ICD and it also worked.. You apparently have hardware issues on that end.

Dave

The follwing is the list file that I generated.
*******************************************
CCS PCM C Compiler, Version 3.058, 6945

Filename: D:\PIC\MPLAB\PROJECT\MISC\TST877.LST

ROM used: 54 (1\%)
Largest free fragment is 2048
RAM used: 6 (3\%) at main() level
7 (4\%) worst case
Stack: 1 locations

*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 017
0003: NOP
.................... #include <16f877.h>
.................... //////// Standard Header file for the PIC16F877 device ////////////////
.................... #device PIC16F877
.................... #list
....................
.................... #use delay (clock=20000000)
0004: MOVLW 22
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 016
0009: MOVLW 06
000A: MOVWF 78
000B: CLRF 77
000C: DECFSZ 77,F
000D: GOTO 00C
000E: DECFSZ 78,F
000F: GOTO 00B
0010: MOVLW 7B
0011: MOVWF 77
0012: DECFSZ 77,F
0013: GOTO 012
0014: DECFSZ 00,F
0015: GOTO 009
0016: RETLW 00
....................
.................... main()
.................... {
0017: CLRF 04
0018: MOVLW 1F
0019: ANDWF 03,F
001A: MOVLW 9F
001B: MOVWF 04
001C: MOVLW 07
001D: MOVWF 00
.................... while(TRUE)
.................... {
.................... output_high(PIN_A2);
001E: BSF 03.5
001F: BCF 05.2
0020: BCF 03.5
0021: BSF 05.2
.................... delay_ms(500);
0022: MOVLW 02
0023: MOVWF 21
0024: MOVLW FA
0025: MOVWF 22
0026: CALL 004
0027: DECFSZ 21,F
0028: GOTO 024
.................... output_low(PIN_A2);
0029: BSF 03.5
002A: BCF 05.2
002B: BCF 03.5
002C: BCF 05.2
.................... delay_ms(500);
002D: MOVLW 02
002E: MOVWF 21
002F: MOVLW FA
0030: MOVWF 22
0031: CALL 004
0032: DECFSZ 21,F
0033: GOTO 02F
.................... }
0034: GOTO 01E
.................... }
0035: SLEEP
___________________________
This message was ported from CCS's old forum
Original Post ID: 1209
Richard Katezansky
Guest







Re: 16F877 refusing to do anything
PostPosted: Sun Nov 18, 2001 7:00 pm     Reply with quote

:=I'm trying to program a 16F877 using the Warp13 programmer and can't get any response out of the chip. I'm using the CCS compiler, and even the simplest program refuses to run. For example:
:=
:=#include <16f877.h>
:=#use delay (clock=20000000)
:=
:=main()
:={
:= while(TRUE)
:= {
:= output_high(PIN_A2);
:= delay_ms(500);
:= output_low(PIN_A2);
:= delay_ms(500);
:= }
:=}
:=

Apart from PortA defaulting to analog on a hard reset all ports default to inputs. You must set the DDR or TRIS register for the port in question to output by clearing the appropriate bits.

:=This compiles and programs just fine, but I'm not seeing any oscillation on the pin. As far as I can tell, my code's not even getting run.
:=Admittedly, a lot of pins on the PIC are floating because they're not used right now... don't know if that could be part of the problem.
:=I've also tried this on 3 or 4 MCUs, so I don't have a bad PIC.
:=Any help anyone could offer would make my day. Thanks!
:=
:=~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1210
Mark Haines
Guest







Fixed!
PostPosted: Sun Nov 18, 2001 11:47 pm     Reply with quote

Aha! Turned out we were having oscillator problems... Once we got the clock oscillator worked out, everything started working for us. Thanks for all your help, everybody!

~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1215
Dave Yeatman
Guest







Re: Fixed!
PostPosted: Mon Nov 19, 2001 3:01 pm     Reply with quote

Mark,
I had problems with 20 mhz oscillators and parasitic capacitance when the leads were too long or placement wasn't just right. I bought a bunch of half size 12,16, 18.432 and 20MHZ cans and now I no longer have to worry about that. I can pretty much put the osc where I want. I also get a much more stable and accurate oscillator as a side benefit.
Dave

:=Aha! Turned out we were having oscillator problems... Once we got the clock oscillator worked out, everything started working for us. Thanks for all your help, everybody!
:=
:=~Mark
___________________________
This message was ported from CCS's old forum
Original Post ID: 1237
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