CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

simulation problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
slyman



Joined: 02 Apr 2015
Posts: 5

View user's profile Send private message

simulation problem
PostPosted: Thu Apr 02, 2015 2:33 pm     Reply with quote

Hi everyone,
I'm trying to simulate my code in isis. When I simulate it's not work as I expect. My friend send his design, it's working well. I created same design it's still dosen't work.
So please help me. My midterm exam is coming and I don't know what to do
Code:
#include <16f877.h>
#fuses   XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock=4000000)
#use fast_io(b)
int i;

#int_ext
void ext_kesmesi()
{
   output_high(pin_b1);
   delay_ms(1000);
   output_low(pin_b1);
   delay_ms(3000);
   for (i=0;i<10;i++)
   {
      output_high(pin_b1);
      delay_ms(500);
      output_low(pin_b1);
      delay_ms(500);
   }
}
void main()
{
   set_tris_b(0x01);
   output_b(0x00);
   ext_int_edge(H_TO_L);
   enable_interrupts(INT_EXT);
   enable_interrupts(GLOBAL);
   while(1);
}
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 2:59 pm     Reply with quote

I have the answer for your question! would you please visit this link:
http://www.ccsinfo.com/forum/viewtopic.php?t=47549
slyman



Joined: 02 Apr 2015
Posts: 5

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 3:03 pm     Reply with quote

I new saw that. I wouldn't ask if it isn't urgent.
and I am sorry
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 3:10 pm     Reply with quote

Try this:

Code:
#include <16f877.h>
#fuses   XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock=4000000)
#use fast_io(b)

void ext_kesmesi()
{
   int i;        /* Keep your vriable local as much as you can */
      output_high(pin_b1);
     delay_ms(1000);
      output_low(pin_b1);
      delay_ms(3000);
      for (i=0;i<10;i++)
      {
            output_high(pin_b1);
            delay_ms(500);
            output_low(pin_b1);
            delay_ms(500);
      }
}

void main()
{
   while(true)
   {
      ext_kesmesi() ;
   }      
 
}
slyman



Joined: 02 Apr 2015
Posts: 5

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 3:20 pm     Reply with quote

I was making changes in lines. I delete #use fast_io(b) and it worked.
Can anyone explain why ?
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 3:24 pm     Reply with quote

My bad, The CCS manual stated

Code:
"#USE FAST_IO(port) This directive will configure the I/O port to use the fast method of performing I/O.
The user will be responsible for setting the port direction register using the
set_tris_x() function."
slyman



Joined: 02 Apr 2015
Posts: 5

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 3:48 pm     Reply with quote

Thank you for reply. I will be more careful and follow the rules Smile
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Thu Apr 02, 2015 3:50 pm     Reply with quote

You are welcome,
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group