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 support@ccsinfo.com

PIN_B5 problem

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



Joined: 16 Mar 2005
Posts: 13

View user's profile Send private message

PIN_B5 problem
PostPosted: Sat Jun 11, 2005 2:12 pm     Reply with quote

Hi
In my project I have an interface between 74ls90 (counter) and 18f452.
I obtain a value with using 74ls90 nad then using 18f452's ext interrupt routine to take the value of counter. From B4-B7 I take the 4 bit value of counter, I take this information and do different jobs that changes with the value of B4--B7 value.
My problem is when the counter value is 2,3,6,7 (where the B5 pin is high) my program doesn't work. it does not do anything. here is my code
Code:

#include <18F452.h>
#device adc=8
#use delay(clock=10000000)
#fuses NOWDT,WDT128,HS, BORV20

#byte pa   =0xF80   
#byte pb   =0xF81   
#byte pc   =0xF82   
#byte pd   =0xF83

int8 n=0;
int8 count=0;
int8 a,b=1;
#bit t4      =pb.7
#bit t3      =pb.6
#bit t2      =pb.5
#bit t1      =pb.4

void init(void)
 {
   SET_TRIS_B(0xf7);
   SET_TRIS_C(0x00);
   SET_TRIS_D(0x00);
   
 }
#int_EXT
EXT_isr()
{

    pc=count;
    delay_ms(170);
    pc=0;

 if(b==1)
 {
    if((t4==0)&&(t3==0))
          {
           if((t2==0)&&(t1==1))
            { n=1;pc=n;
            delay_ms(170);
            start();
              break;
            }
           if((t2==1)&&(t1==0))
            { n=2;pc=n;
            delay_ms(170);
            start();
              break;
            }
           if((t2==1)&&(t1==1))
            { n=3;pc=n;
            delay_ms(170);
            start();
              break;
            }
          }
    if((t4==0)&&(t3==1))
          {
           if((t2==0)&&(t1==0))
            {  n=4;pc=n;
            delay_ms(170);
            change();
               break;
            }
           if((t2==0)&&(t1==1))
            {  n=5;pc=n;
            delay_ms(170);
             change();
               break;
            }
           if((t2==1)&&(t1==0))
            {  n=6; pc=n;
            delay_ms(170);
             change();
               break;
            }
           if((t2==1)&&(t1==1))
            {  n=7;pc=n;
            delay_ms(170);
             change();
               break;
            }
          }
    else
     break;
  }
     
}


Thanks for Advice

Best Regards
Ariza Razz
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jun 11, 2005 3:02 pm     Reply with quote

Pin B5 is used for Low Voltage Programming, which is enabled by default
on new chips. If pin B5 is set at a logic-high level, the PIC will go into
LVP programming mode. Solution: Add the NOLVP parameter to
your #fuses statement. Example:

#fuses NOWDT, WDT128, HS, BORV20, NOLVP
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