MikroC v6.0
Code:
Code: Select all
//unsigned temp;
//char error = 0;
//sbit error_led at GP2_bit;
void Init() {
TRISIO = 0;
GPIO = 0;
CMCON0 = 1;
ANSEL = 0;
//error = Soft_UART_Init(&GPIO, 0, 1, 9600, 0);
//if (error > 0)
// while (1) {
// error_led = ~error_led;
// Delay_ms(1000);
// }
}
void main() {
Init();
while (1) {
//Ow_Reset(&GPIO, 4); // Onewire reset signal
//Ow_Write(&GPIO, 4, 0xCC); // Issue command SKIP_ROM
//Ow_Write(&GPIO, 4, 0x44); // Issue command CONVERT_T
//Delay_ms(750);
//Ow_Reset(&GPIO, 4);
//Ow_Write(&GPIO, 4, 0xCC); // Issue command SKIP_ROM
//Ow_Write(&GPIO, 4, 0xBE); // Issue command READ_SCRATCHPAD
//temp = Ow_Read(&GPIO, 4);
//temp = (Ow_Read(&GPIO, 4) << 8) + temp;
//temp = 0x40;
//Soft_UART_Write(temp);
GP5_bit = ~GP5_bit;
Delay_ms(500);
}
}
Config:
INTOSCIO
All disabled (except Fail-Safe Monitor)
8 MHz
5Volts in Vcc
Connections:
Vcc: 5V
Vss: Ground
GP2: Led to ground
Any clues?