View previous topic :: View next topic |
Author |
Message |
Bob Guest
|
16c765 not working with a simple prog |
Posted: Wed Jan 07, 2004 10:56 am |
|
|
Hit there. I am a new to this forum.
I tried everything but even the simplest program (see below) does not work.
It compiles fine, and I flash it with Icprog v1.05c.
After flashing Icprog tells me that the component is well verified but when powering up the chip, outputs are not initialized at high levels as they should!
I tried to put a delay to make sure it was not a timing issue, but same problem occurs.
Any suggestion would be most welcome as I am in a dead-end...
Bob.
_________________________________________________
#include <16C765.h>
#use delay(clock=20000000)
void main()
{
SET_TRIS_A(0b000000); //configuration of port A (0=Output 1=Input)
SET_TRIS_B(0b00000000); //configuration of port B (0=Output 1=Input)
SET_TRIS_C(0b00000000); //configuration of port C (0=Output 1=Input)
SET_TRIS_D(0b00000000); //configuration of port D (0=Output 1=Input)
delay_ms(500);
OUTPUT_HIGH(PIN_B1) ;
OUTPUT_HIGH(PIN_B2) ;
OUTPUT_HIGH(PIN_B3) ;
OUTPUT_HIGH(PIN_B4) ;
OUTPUT_HIGH(PIN_B5) ;
OUTPUT_HIGH(PIN_B6) ;
OUTPUT_HIGH(PIN_B7) ;
OUTPUT_HIGH(PIN_B0) ;
OUTPUT_HIGH(PIN_A0) ;
OUTPUT_HIGH(PIN_A1) ;
OUTPUT_HIGH(PIN_A2) ;
OUTPUT_HIGH(PIN_A3) ;
OUTPUT_HIGH(PIN_A4) ;
OUTPUT_HIGH(PIN_A5) ;
OUTPUT_HIGH(PIN_C1) ;
OUTPUT_HIGH(PIN_C2) ;
OUTPUT_HIGH(PIN_C3) ;
OUTPUT_HIGH(PIN_C4) ;
OUTPUT_HIGH(PIN_C5) ;
OUTPUT_HIGH(PIN_C6) ;
OUTPUT_HIGH(PIN_C7) ;
OUTPUT_HIGH(PIN_C0) ;
OUTPUT_HIGH(PIN_D1) ;
OUTPUT_HIGH(PIN_D2) ;
OUTPUT_HIGH(PIN_D3) ;
OUTPUT_HIGH(PIN_D4) ;
OUTPUT_HIGH(PIN_D5) ;
OUTPUT_HIGH(PIN_D6) ;
OUTPUT_HIGH(PIN_D7) ;
OUTPUT_HIGH(PIN_D0) ;
} |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Wed Jan 07, 2004 11:27 am |
|
|
How are you setting the fuses? |
|
|
diego_huelva Guest
|
|
Posted: Wed Jan 07, 2004 11:45 am |
|
|
The PIC16C765 only works at 24 MHz!!!
You can use a 24 Mhz crystal (fuse HS) or a 6 Mhz crystal (fuse H4)
(H HS 4k PLL in IcProg) |
|
|
Bob Guest
|
|
Posted: Wed Jan 07, 2004 2:14 pm |
|
|
I want to use the pic at 24Mhz,
i have to put "HS" in oscillator in ICprog ? |
|
|
Guest
|
|
Posted: Thu Jan 08, 2004 5:52 am |
|
|
Yes!!!!! but only if you circuit has a 24 Mhz osc.
CCS code...
//if 24 Mhz osc (in ic prog put HS)
#include <16C765.h>
#device *=16
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=24000000)
//if 6 Mhz osc (in ic prog put H3 HS 4k PLL)
#include <16C765.h>
#device *=16
#fuses H4,NOWDT,NOPROTECT
#use delay(clock=24000000) |
|
|
|