Change code from C to picbasic

Status
Not open for further replies.

savnik

Member
Code:
int setFreq[] = {1,0,1,1,1,1,1,1,1,1,0,1,0,0,1,0};
// set the frequency to 102.1 MHz and other config bits for audio IC
// write_to_chip - write enable, clock, and data bits to audio IC
void write_to_chip(){
int i,j;
PBOUT |= 0x01;
for(j = 0; j <= 10; j++) // set a clock delay
asm("nop");
for(i = 0; i < 16; i++){
if(setFreq[i] == 1)
PBOUT |= 0x04; // set data bit
else PBOUT &= 0xFB;
for(j = 0; j <= 10; j++) // set clock down delay
asm("nop");
PBOUT |= 0x02; // turn clock on
for(j = 0; j <= 10; j++) // set up clock delay
asm("nop");
PBOUT &= 0xFD; // turn clock off
}
PBOUT &= 0xFE;
}

How to change this code to picbasic pro
I use 16f88
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…