Hello,
On Thursday, June 9, 2011, Laurent FAILLIE <[email protected]> wrote:
> Hello,
>
> I have a problem that drive me nuts for a while : how to make leds linking :(
>
> I'm using a 16F88 with following program :
>
>
> /* ----------------------------------------------------------------------- */
> /* Fichier source modèle généré par Piklab */
> #include <pic16f88.h>
>
> /* ----------------------------------------------------------------------- */
> /* Bits de configuration: adapté à votre dispositif et à vos besoins */
> typedef unsigned int word;
>
> word at _CONFIG1 CONFIG1 = _WDT_OFF & _PWRTE_OFF & _INTRC_IO & _MCLR_OFF &
> _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_PROTECT_OFF & _DEBUG_OFF & _CCP1_RB0
> & _CP_OFF;
> word at _CONFIG2 CONFIG2 = _FCMEN_OFF & _IESO_OFF;
>
> #define LED RA0
>
> void main() {
> int
> i;
>
> /* Initialisation general*/
> OSCCON = 0b01110000; // Oscillateur interne a 8Mhz
>
> /* Initialisation des IO */
> ANSEL = 0; // Port a en Numerique
> TRISA = 0; // Tout en sortie
> TRISB5 = 0; // RB5/TX en sortie
>
> while(1){
> PORTA = 255;
> RB5 = 0;
> for(i=0;i<30000;i++);
> PORTA = 0;
> RB5 = 1;
> for(i=0;i<30000;i++);
> }
> }
>
> So nothing complex :)
> It's working find on GPSIM ... but when I put it on a real PIC, nothing
> happens. Both port A and PortB.5 stay
> low.
>
How did you know that the port/pin was stayed low? Did you measured it
by osciloscope or by inspecting the LED (which was "never turned on")?
Have you tried to test the following code?
While(1)
{
PORTA=255;
RB5 = 1;
}
If the code above worked, it's mean the delay wasn't enough. You
should increase it from 30000 to higher value. If not, check the power
supply quality as suggested before.
Regards,
I Putu Susila
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user