+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 2
    Points: 264, Level: 3

    Join Date
    Feb 2014
    Posts
    2
    Helped
    0 / 0
    Points
    264
    Level
    3

    PIC 16f877a coding..

    hello,im new around here and im not limited internet connection. im doing a project named automatic handwash with auto refill. well here is my coding. im using mikroC for the coding.

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    
    void portb0() ;
    void main() {
     
      int mot0 = 0;
      int mot1 = 0;
      TRISA = 0b00000000;
      PORTA = 0x00;
      TRISB = 0b00000000;
      PORTB = 0x00;
      TRISC = 0b11111111;
      PORTC = 0x00;
      TRISD = 0b11111111;
      PORTD = 0x00;
      
    while (1)
    {
    if (PORTC.f0 == 1)
    while(1)
    {
    portb0() ;
    if (porta.f1 = 0)
       portd.f2 = 1 ;
       delay_ms(5000) ;
     
    if (porta.f2 = 0)
       portd.f3 = 1;
       delay_ms(5000) ;
     
     
    break ;
     }
    else
    {
    PORTB == 0 ;
                  }
     }
    }
    void portb0 (void) {
         portb.f0 = 0x00000001 ;  //air
         
         delay_ms(600) ;
         
         portb.f0 = 0x00000000 ;
         portb.f1 = 0x00000001 ;  //sabun
         
         delay_ms(150) ;
         
         portb.f1 = 0x00000000 ;
         portb.f0 = 0x00000001 ;  //air
         
         delay_ms(600) ;
         
         portb.f0 = 0x00000000 ;
         portb.f2 = 0x00000001 ;  //blower
         
         delay_ms(600) ;
         
         portb.f2 = 0x00000000 ;
         portb.f3 = 0x00000001 ;  //sanitizer
         
         delay_ms(150) ;
         
         portb.f3 = 0x00000000 ;
     
         }

    based on the coding, i manage to get all the washing circuit to work, but my problem is on the refill circuit as i dont know the coding. i know that port A can be used as ADC but i dont know how to use it. my liquid level sensor circuit work properly but i need the coding on PIC. i want to make when port A2 and A3 read 0V,it will turn on port D2 and D3.. can anyone help me?? im really noob in this

    please and thank you

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 4
    Points: 7,825, Level: 21
    Achievements:
    7 years registered
    paulfjujo's Avatar
    Join Date
    Jun 2008
    Location
    France 01120
    Posts
    1,291
    Helped
    261 / 261
    Points
    7,825
    Level
    21

    Re: PIC 16f877a coding..

    hello,

    my liquid level sensor circuit work properly
    so,is it an analog level sensor.?
    if yes, what kind of signal is delivered by this ?
    it must be in the range 0 to 5 V for all of the measuring range..

    i want to make when port A2 and A3 read 0V
    do you have 2 analog sensors ?
    or 2 dry contact ?

    Explain clearly to get support...

    Maybe with a drawing with sensor location ..water circulation..


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  3. #3
    Newbie level 2
    Points: 264, Level: 3

    Join Date
    Feb 2014
    Posts
    2
    Helped
    0 / 0
    Points
    264
    Level
    3

    Re: PIC 16f877a coding..

    Quote Originally Posted by paulfjujo View Post
    hello,


    so,is it an analog level sensor.?
    if yes, what kind of signal is delivered by this ?
    it must be in the range 0 to 5 V for all of the measuring range..


    do you have 2 analog sensors ?
    or 2 dry contact ?

    Explain clearly to get support...

    Maybe with a drawing with sensor location ..water circulation..
    yes the output is 5V..but i need it to be 0V which means the PIC read it as logic 0. it is the same circuit actually. but i make it 2. i will attach my circuit. im sorry mate.




--[[ ]]--