Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

Back
Top