Jump to content

Recommended Posts

I want to use an 18K14K50 in a project but I can't get it to work at all.

In an attempt to get *anything* to work I've removed all the hardware and software and failed to even get the basics to work now...


I've connected a PICKIT2 programmer to it to program it and a single LED and resister to pin 16 which is RC0. No other hardware is attached.

I want to configure it to use the internal oscillator to to simplify things until I get it to work at all.


And then written the program like this -


I can think of two things that might be wrong, either my config settings which are suppose to set it to use the internal oscillator, or I'm failing to set up some essential control to use digital outputs.


Any advice would be welcome



#include <system.h>

#pragma config CPUDIV = NOCLKDIV
#pragma config USBDIV = OFF
#pragma config FOSC = IRC
#pragma config PLLEN = OFF
#pragma config PCLKEN = ON
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRTEN = ON
#pragma config BOREN = ON
#pragma config BORV = 27
#pragma config WDTEN = OFF
#pragma config WDTPS = 1
#pragma config MCLRE = OFF
#pragma config HFOFST = OFF
#pragma config STVREN = ON
#pragma config LVP = ON
#pragma config BBSIZ = OFF
#pragma config XINST = OFF
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRTB = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTRB = OFF
#pragma config WDTEN = OFF
/* Internal oscillator default frequency ( I think...) */
#pragma CLOCK_FREQ 1000000

/* Disable all the analogue parts so that digital output works */
inline void pic_set_digital() 
ansel	   = 0;
anselh	  = 0;

void main()
trisc = 0x00;

	portc = 0xFF;

	portc = 0x00;

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...