Clones are very different inside!!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I notice you have usb port on there, is that how you program? without pickit?
and debug with that too?
looks fairly straight forward, looks like it is just passing data, converting protocol from usb to an spi or i2c? just guessing as to icsp protocol is...
doesn't the linker or software on the pc side handle that though?
.... and that is the part missing under the hood of my clone ?
#pragma config FOSC = INTOSCIO
#pragma config WDTE = OFF
#pragma config PWRTE = OFF
#pragma config BOREN = OFF
#pragma config CPD = OFF
#pragma config CP = OFF
#pragma config MCLRE = OFF
#pragma config IESO = OFF // Internal External Switchover bit (Internal External Switchover mode is enabled)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is enabled)
#include <xc.h>
//#include <htc.h>
//#include <stdio.h>
//#include <stdlib.h>
//#include <pic16f688.h>
#define _XTAL_FREQ 8000000
void READCAP()
{
PORTCbits.RC4 = !PORTCbits.RC4; // outter wire
PORTCbits.RC5 = !PORTCbits.RC5; //inner wire
}
void LED(unsigned char col)
{
if ((col == 2)||(col == 4)||(col == 5)||(col == 7)){PORTCbits.RC1 = 0;} else{PORTCbits.RC1 = 1;} //green
if ((col == 3)||(col == 5)||(col == 6)||(col == 7)){PORTCbits.RC0 = 0;} else{PORTCbits.RC0 = 1;} //blue
if ((col == 1)||(col == 4)||(col == 6)||(col == 7)){PORTCbits.RC2 = 0;} else{PORTCbits.RC2 = 1;} //red
}
void setup(void)
{
OSCCON = 0x70; // switch to 8MHz system clock
ANSEL = 0b00000000; //All I/O pins are configured as digital
CMCON0 = 0x07 ; // Disbale comparators
TRISC = 0b00000000; // PORTC All Outputs
TRISA = 0b11111111; // PORTA All off for now
PORTA=255;
PORTC=255;
}
int main(int argc, char** argv)
{
unsigned char leds = 0;
setup();
PORTCbits.RC0 = 0; //blue on
__delay_ms(1000);
PORTCbits.RC0 = 1; //blue off
__delay_ms(1000);
while(1)
{
if (leds>8){leds = 0;}else{leds++;}
LED(4);
// READCAP();
__delay_ms(1000);
}
}
unsigned char cols[8] = {7,3,5,6,1,4,2,0};
void LED(unsigned char col) {
PORTC = cols[col];
}
void LED(unsigned char col)
{
unsigned char byteout = 7;
unsigned char porbuf = PORTC & 0b11111000;
if ((col == 1)||(col == 4)||(col == 6)||(col == 7)){byteout -= 4;}//{PORTCbits.RC2 = 0;} else{PORTCbits.RC2 = 1;} //red
if ((col == 2)||(col == 4)||(col == 5)||(col == 7)){byteout -= 2;}//{PORTCbits.RC1 = 0;} else{PORTCbits.RC1 = 1;} //green
if ((col == 3)||(col == 5)||(col == 6)||(col == 7)){byteout -= 1;}//{PORTCbits.RC0 = 0;} else{PORTCbits.RC0 = 1;} //blue
PORTC = porbuf + byteout;
__delay_us(100);
}
int READCAP(void)
{
unsigned int level = 0;
unsigned char porbuf = PORTC || 0b00010000;
PORTCbits.RC5 = 0; __delay_ms(1000);
TRISCbits.TRISC4 = 0; __delay_ms(1000);
PORTCbits.RC4 = 1; // LINE #1
// PORTC = porbuf; // LINE #2
__delay_ms(1000);
TRISCbits.TRISC4 = 1;
while(PORTCbits.RC4 == 1 & level<5000){level++;__delay_us(10);}
TRISCbits.TRISC4 = 0;
PORTCbits.RC4 = 0;
// PORTCbits.RC4 = !PORTCbits.RC4; // outter wire
// PORTCbits.RC5 = !PORTCbits.RC5; // inner wire
return level;
}