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

a question about command output_bit(x,y)

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



Joined: 11 Apr 2014
Posts: 2

View user's profile Send private message

a question about command output_bit(x,y)
PostPosted: Fri Apr 11, 2014 4:19 pm     Reply with quote

hi everyone. I have a problem. I use very simple command output_bit(x,y) but I can not work it. I am sharing you my commands and screenshot of proteus of my circuit. first command is working correctly but second and third command give me +5V always on PIN_E1 and E2. It is very simple command but I can not understand why it is not change, why give me always +5V?



output_bit(PIN_E0, DZEMIN); //it is working
output_bit(PIN_E1, SZEMIN); //it is not working
output_bit(PIN_E2, KZEMIN); //it is not working



Code:
#include <main.h>

#use fast_io(a)
#use fast_io(b)
#use fast_io(c)
#use fast_io(d)
#use fast_io(e)

//KABIN DISI BUTONLARI
#define DZEMIN first_ls165(3)
///////////////////////first ls165////////////////
#define first_lsclock pin_b1
#define first_lsshld pin_b2
#define first_lsso pin_b0
///////////////////////////////////////////////////
#define  SZEMIN pin_d5
#define  KZEMIN       pin_a3



////////////////////first ls165//////////////////////
int1 first_ls165(int i){
int1 firstarray[8];
int firsta;

output_low(first_lsshld);
delay_us(10);
output_high(first_lsshld);   

for (firsta=0;firsta<8;firsta++)
   {
firstarray[firsta]=input(first_lsso);
delay_us(10);
output_high(first_lsclock);
delay_us(10);
output_low(first_lsclock);
delay_us(10);}

return firstarray[i];
}
//////////////////////////////////////////////


void main()
{

setup_spi(SPI_SS_DISABLED); // SPI birimi devre dışı
setup_timer_1(T1_DISABLED); // Timer1 devre dışı
setup_timer_2(T2_DISABLED,0,1); // Timer2 devre dışı
setup_adc_ports(NO_ANALOGS); // ANALOG girdi yok
setup_adc(ADC_OFF);  //  ADC birimi devre dışı
setup_CCP1(CCP_OFF); // CCP1 birimi devre dışı
setup_CCP2(CCP_OFF); // CCP2 birimi devre dışı

set_tris_a(0b001111);  //
set_tris_b(0b01110001);  //
set_tris_c(0b00000000);  //
set_tris_d(0b00111100);  //
set_tris_e(0b00000000);  //
output_a(0x00);
output_b(0x00);
output_c(0x00);
output_d(0x00);
output_e(0x00);

    while(true)
   {
      {             
output_bit(PIN_E0, DZEMIN);
output_bit(PIN_E1, SZEMIN);
output_bit(PIN_E2, KZEMIN);

      }
   }
}




cencan



Joined: 11 Apr 2014
Posts: 2

View user's profile Send private message

PostPosted: Fri Apr 11, 2014 4:24 pm     Reply with quote

my code and proteus files:

http://speedy.sh/6rfPn/codefile.zip
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Apr 11, 2014 4:56 pm     Reply with quote

this is a ccs forum.
proteus forum must be somewhere else.

see this explanation of the prolem:

http://www.ccsinfo.com/forum/viewtopic.php?t=47549
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 11, 2014 6:08 pm     Reply with quote

We don't have to consider Proteus. Let's just look at the CCS
function syntax. Here is a section of your code:
Quote:

#define SZEMIN pin_d5
#define KZEMIN pin_a3

output_bit(PIN_E1, SZEMIN);
output_bit(PIN_E2, KZEMIN);


Your code above is evaluated by the compiler into this:
Quote:

output_bit(PIN_E1, PIN_D5);
output_bit(PIN_E2, PIN_A3);

This is not the correct syntax for the output_bit statement. You should
not give it two pin names. Download the CCS manual and read the
section on output_bit():
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
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