Excellent PORTB is now changing when I push the button. Thanks for the help. Well happy. Plus I learned a bunch of stuff about how to configure ports. My If statements still aren't working though for some odd reason
No in your case strictly speaking only the ANS10 bit need to be cleared. But making it a habit to clear those registers can save you a lot of problems.Is it both ANSEL and ANSELH that need to be cleared for my purpose?
#define _XTAL_FREQ 8000000 //Using 8MHz clock speed
IF(!RB0)//same as IF(RB0==0)
IF(RB0)//same as IF(RB0==1)
//use what you like best
Post you code just so we are sure what you are doing. A common mistake not to use TWO underscores like this __DELAY_MS(500) But making to long delays will also make an errorok great thanks I will try that now. One final problem. I am trying the delay you suggested and I am getting an error. I did put in the #define you suggested also. The error is unable to resolve identifier
/*
* File: Lab1inC1.c
* Author: David
*
* Created on 16 June 2013, 21:22
*/
#include <xc.h>
#define _XTAL_FREQ 8000000 //Using 8MHz clock speed
void main(void){
char Blink;
char Counter;
//Configuring PortD as an Input
TRISD = 0x00;
//Blinky
while(1){
//__delay_ms(100)
Blink = 0x01;
PORTD=Blink;
__delay_ms(1000) // request a delay in milliseconds
Counter = 0x00;
while(Counter<7){
Blink = Blink << 1;
PORTD=Blink;
Counter++ ;
CLRWDT();
}
}
}
/*
* File: Lab1inC1.c
* Author: David
*
* Created on 16 June 2013, 21:22
*/
#include <xc.h>
#define _XTAL_FREQ 8000000 //Using 8MHz clock speed
void main(void){
char Blink;
char Counter;
//Configuring PortD as an Input
TRISD = 0x00;
//Blinky
while(1)
{
//__delay_ms(100)
Blink = 0x01;
PORTD=Blink;
__delay_ms(1000); // request a delay in milliseconds
Counter = 0x00;
while(Counter<7){
Blink = Blink << 1;
PORTD=Blink;
Counter++ ;
CLRWDT();
}
}
}
He said PIC, not PICkit. You need to check how many breakpoints your PIC supports. They take hardware to do that.It could be that your PIC do not support more than one breakpoint with your programmer(PICKIT 2?)
ICD3 and Real ICE units support what is named "software breakpoints" PICKIT 2 and 3 do not support this only HW breakpoints. HW breakpoints is limeted as followsHe said PIC, not PICkit. You need to check how many breakpoints your PIC supports. They take hardware to do that.
Most PICs I've used with either the PICkit 2 or 3 (and even the ICD3) support 3 breakpoints.
BTW, inside the Microchip library there is a lovely file called ":\Microchip Solutions\Microchip\Common\TimeDelay.c." There's a header file too in the \include folder.