Jump to content

Maister

EstablishedMember
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Maister

  • Rank
    Regular
  1. Hello! Thanks for answers and help! Dave, the target 16F84 hasn't got adcon register. Can be behind another name? Thanks!
  2. Thanks Danmc77! I didn't see your last message, while I was posting my last question. I will try this and tell you if it is working "Maister, What hardware are you using to run this code? " I don't understand this perfectly Thanks for the answers!
  3. Hello! The target is PIC 16F84.Please, tell me something. What is correct for my program: if( ra2=0 ) . . . or if( ra2==0 ) . . . . Thanks for the answers
  4. Hello! Dave, there is my program. The buttons are connect on ra0 and ra2.When I push button I get logical 0. So, when I press button just for a while, I need 5V on the ra1 for long time not just for the time that the button was pressed.The same is for the portb. I also need value of portb for long time. But when I press ra0, I need on ra1 0V and new value of portb for a long time, so long that ra2 will be pressed again. I'm bad at English so I hope that I wrote this clearly and I hope that you understan this. This program now is not working, like it has to be. #include <system.h> void main() { volatile bit ra2@PORTA.3; volatile bit ra1@PORTA.1; volatile bit ra0@PORTA.0; trisb= 0; set_bit( trisa,0 ); clear_bit( trisa,1 ); set_bit( trisa,2 ); loop: if( ra2=0 ) ra1=1; portb=11011011b; if( ra0=0 ) ra1=0; portb=01100001b; goto loop; } Thanks for the answers!
  5. Hello! O.K I will post my program later, because I am not having it right now at myself. Please, tell me what is the difference between this, if is on the ra0 push button? { if (ra0==1) . . . . } and { if (ra0=1) . . . . }
  6. Hello! Yes, I forgot something (trisb= 0;) This program is working just like I want ,but I want to do something more. I want to put on portb 7 segment display. My idea was something like that: When I press the button first time, I get a 5V on the ra1.In that time when the ra1 is 5V I want to have value of portb=01100000b (for number on 7segment display). Than I press the button again and I get 0V on the ra1 for the time ,when the button will be pressed again.In that time when the ra1= 0V I need value of portb=11011010b(for new number on 7segment display). I want to know how can I correct my programe, thaT will be work like I wrote. Please, help me Beginner!
  7. Hello! I wrote simple program, that makes logical 1 on ra1 when I press a button, and logical 0 when I press button again. Now I need little help. I want to have value of portb=01100000b , when the ra1 is 0 and portb=11011010b when the ra1 is 1. I tried to do something, but than my programe didn't work like that I want. Please help me My program: #include <system.h> void main() { volatile bit ra1@PORTA.1; volatile bit ra0@PORTA.0; set_bit( trisa,0 ); clear_bit( trisa,1 ); { ra1= 0; loop: if( ra0==0 ) ra1=!ra1; goto loop; } }
  8. I read on the SourceBoost home page, that is BoostC compiler totaly free for target 16F84,so I don't understand why my Compiler doesn't work enymore I got a message that is useful just for 3 days. Please tell me what I have to do with my SourceBoostC, that will be work normaly. Thanks for the answers!
  9. Thank you danmc77! Now I have got two questions for you? Please tell me if I am right? I think it has to be: while(1) // Do this forever { if ( rb0 == 1 ) // Is the button pushed? rb1 = 1; // Button's pushed, so light the LED else rb1 = 0; // Buttons released, LED is off } or while(1) // Do this forever { if ( rb0 == 0 ) // Is the button pushed? rb1 = 0; // Buttons released, LED is off else rb1 = 1; // Button's pushed, so light the LED } My next question is: Why it has to be while(1) // Do this forever Thanks for the answers!
  10. Hello! I have got one problem.I need one simple basic example for 16F84 using a button. I wrote something but it doesn't work. I need that sort of a program, that I will press button just once and I will get a logical 1 on RB0 for example... Please help me!
  11. Hello! Thank You Dave for the answers. My problem is, that I don't know what I must write in header file. Please, give me one simple example Could I write just .c function and than call this function in my source code? Why do we need header file? I'm sorry for this school questions,but I'm new at that Thanks for the answers!
  12. Hello! Could anybody explain me what is the diffrence between this: volatile bit bPin0 @ PORTA.0 or bit bPin0 @ PORTA.0 Now I have got some questions In wheech file I have to save some function, if I want to use that function in new program code. How I call that function in my new program? I hope you understand my questions? Thanks for the answers!
  13. Dave,Idon't understand you perfectly.I wrote trisb = 0; in my programe. Now I tried this code for PIC16F84a.The compiler gave me next messages: BoostC Optimizing C Compiler Version 2.0.1 Beta (for PIC16 architecture) http://www.picant.com/c2c/c.html Copyright© 2004-2005 Pavel Baranov Copyright© 2004-2005 David Hobday 7segmentni_C.pp(1): error: failure failure Exit code was 1. Removing target: 7segmentni_C.obj Failed to locate output file '7segmentni_C.obj' Done Failed Please,tell me what i did wrong. Thanks for the answers!
  14. I tried to do that,but it doesn't work.I wrote simple program,counter from 0 to 1. Something in the program is not right.I am going to put 7segment LED display on PORTB. Please tell me where is the mistake. There is my simple program. #include <system.h> void main() { trisa= 0; //output trisb= 0; //output loop: PORTB= 11111100b; //value of PORTB. delay_s( 1 ); PORTB= 01100000b; //value of PORTB. delay_s( 1 ); goto loop; }
  15. Hello! I have got one similar question. I want to write in register some Bin number.For example: I need 11111100 in register PORTB.I think that is not right(PORTB=11111100) Please tell me how can I do this? Thanks for the answers!
×
×
  • Create New...