Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 2nd December 2008, 05:40 AM   #1
Default PIC16F690 code problems

I'm just starting with the PIC micros so am learning as I go. I'm using the PICkit2 to program 16F690 micro that came on the PICkit 2 Low Count Demo board. I'm using MicroCode Studio to write the code and the PICkit 2 programmer software to load the hex file into the 16F690. I'm following the online directions for the first program which is supposed to make an LED blink on and off. All that happens is that the first LED, which correlates to C.0, blinks twice very briefly. I can change it to C.0 to C.1 and then the second LED blinks twice. So I can see that the correct LED is blinking but why does it blink twice and stop. I can take the loop & goto loop out and it will still blink twice very quickly. I can change the pause times and it still has no effect on how long the LED stays on and off. What am I doing wrong? Also, does anyone know of a schematic of the PICkit 2 Low Pin Demo board? There is a PDF of the top layer of traces but a similar picture of the bottom layer of traces would be helpful as well. I should note that I do not have an external power supply hooked up to the board but rather it is getting its power through the PICkit 2 programmer which is hooked up to my computer via USB connection. The code is as follows....

TRISC = %00000000 'Sets port C to all outputs

loop:

High PORTC.0 ' Turn on LED
Pause 500 ' Delay for .5 seconds

Low PORTC.0 ' Turn off LED
Pause 500 ' Delay for .5 seconds

Goto loop ' Go back to loop and blink LED forever
End
bigfarmerdave is offline  
Old 2nd December 2008, 05:47 AM   #2
Default

Hi,
How's the connection of the PIC? MCLR? And do you have decoupling capacitor (100 nF across vdd and vss)?
What about the configuration settings?
__________________
bananasiong

Last edited by bananasiong; 2nd December 2008 at 05:47 AM.
bananasiong is offline  
Old 2nd December 2008, 06:07 AM   #3
Default Here is the schematic of the PICkit 2 demo board

The cap is already on there. I assume that MCLR is being taken care of by the PICkit 2 programmer?
Attached Thumbnails
PIC16F690 code problems-pic-16f690.jpg  
bigfarmerdave is offline  
Old 2nd December 2008, 06:52 AM   #4
Default

Hi,
MCLR is taken care by the programmer for only programming with supplying Vpp, not while executing the program. Is JP5 shorted? Try to short JP5 after programming with PICkit2. What are the configuration settings?
__________________
bananasiong

Last edited by bananasiong; 2nd December 2008 at 06:54 AM.
bananasiong is offline  
Old 2nd December 2008, 07:01 AM   #5
Default

Quote:
Originally Posted by bananasiong View Post
What are the configuration settings?
YES! Is the WDT disabled?
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 2nd December 2008, 03:46 PM   #6
Default

Quote:
Originally Posted by bigfarmerdave View Post
Also, does anyone know of a schematic of the PICkit 2 Low Pin Demo board?
When the Pickit2 program is opened, check the help tab, where there is a LPC demo board guide pdf link. Why they couldn't put the pinouts for the socket/header (on the solder mask) is beyond me, even if it was on the underside of the board.

EDIT: Well now that I'm signed in, I see you found it. This happens to me when first cup of coffee has not propped open my eyes.

Last edited by nickelflippr; 2nd December 2008 at 03:52 PM.
nickelflippr is offline  
Reply

Tags
code, pic, problems

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
code problems for 4x4 keypad darsin General Electronics Chat 27 16th July 2008 07:20 AM
OLED LCD Code Problems freeskier89 Micro Controllers 0 4th May 2007 05:47 AM
Input Counter Pic16F84A (Code problems) loco Micro Controllers 4 26th September 2006 02:19 PM
Work ID reader Track 2 problems with pic code. Need help! egg0900 Micro Controllers 2 19th April 2004 07:58 AM
12C508 problems: Verify failed at code address 0000h ! faz666 Micro Controllers 4 29th July 2003 01:13 PM



All times are GMT. The time now is 04:43 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker