Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 25, 2024, 11:16:23 11:16


Login with username, password and session length


Pages: [1]
Print
Author Topic: can't simmulate this snippet  (Read 3653 times)
0 Members and 1 Guest are viewing this topic.
jeanninemtv
Senior Member
****
Offline Offline

Posts: 311

Thank You
-Given: 57
-Receive: 25


« on: August 09, 2009, 02:27:29 14:27 »

i'm trying to blink a led but i have no results on isis... i don't know if it's me or...

Code:
#include <12F675.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOCPD                    //No EE protection
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES PUT                      //Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BANDGAP_HIGH         
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8)
// les pins du 12f675 sont implementés de la même façon que porta ...
#define GP0 PIN_A0
#define GP1 PIN_A1
#define GP2 PIN_A2
#define GP3 PIN_A3
#define GP4 PIN_A4
#define GP5 PIN_A5
#INT_RA
#use fast_io(A)
#define INTS_PER_SECOND 32768 // 1 per sec.
int count=0;
byte x;
byte toggle=0;
byte seconds=0;
byte minutes=0;
byte int_count;
byte one_sec_fl;

#int_timer1 // This function is called every time
void timer1_isr()
{ // (timer1) overflows (255->0).
++count;
one_sec_fl = 1;
set_timer1(0x7fff);
}



void main()
{
   int_count=INTS_PER_SECOND;
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
   setup_comparator(NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_TIMER1); //setup interupts
   enable_interrupts(GLOBAL);
   output_high (GP0);
     
 while(true)
{
   if (one_sec_fl)
    { x^=0x01;
      if (!x)
       output_low (GP0);
      else
       output_high (GP0);
      seconds=0;
      one_sec_fl = 0;

    }
}

 }

   
Logged
kcsoft
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 4
-Receive: 68


« Reply #1 on: August 09, 2009, 11:54:36 23:54 »

you forgot to set the tristate of GP0 to output.
put this before the "while"
   set_tris_a(0xFE);
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC