hello!
i have an application that works. Looks like that:
if I change top lines to:
it stops working.
I do add an external oscillator for 8MHz. Is there a rule of how attach it? Should it use some resistor or capacitor? Am I missing something else?
Thank you!
i have an application that works. Looks like that:
Rich (BB code):
#include <pic.h>
#include <htc.h>
#define _XTAL_FREQ 4000000
__CONFIG(MCLRDIS & BORDIS & INTIO & PWRTEN);
#define SRCLK RB1
#define SRDAT RB2
#define SRLAT RB3
static int iBinary;
void OutPORT(unsigned char data);
void main()
{
CMCON = 0x07;
TRISB = 0x00;
PORTB = 0x00;
iBinary = 0x01;
while(1)
{
OutPORT( iBinary );
__delay_ms( 0x8F );
OutPORT( iBinary );
__delay_ms( 0x8F );
if( ++iBinary == 0x0100 )
{
iBinary = 0x01;
}
}
}
void OutPORT(unsigned char data)
{
unsigned char bits;
for (bits = 0x80; bits != 0; bits >>= 1)
{
if ((bits & data) == bits)
{
SRDAT = 1;
}
else
{
SRDAT = 0;
}
SRCLK = 1;
SRCLK = 0;
}
SRLAT = 1;
SRLAT = 0;
}
Rich (BB code):
#define _XTAL_FREQ 8000000
__CONFIG(MCLRDIS & BORDIS & INTIO & PWRTEN & HS);
I do add an external oscillator for 8MHz. Is there a rule of how attach it? Should it use some resistor or capacitor? Am I missing something else?
Thank you!