problem

Discussion in 'Homework Help' started by aya aya, Jul 10, 2014.

  1. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    hi can anyone help how can i do that:confused::confused:
    Using the CCS and Proteus for the following
    Design a system with PIC 16F877A that contains three input switch A, B and C and the
    output is simply and LED. This output will be the NAND function or the NOR function
    for the two input A and B. switch C will used to change the logic function between
    NAND or NOR logic.
    An LCD must be used to show the selected logic NAND or NOR and to display the two
     
  2. shakilabanu

    Member

    Jul 8, 2014
    44
    2
    Sounds like you are giving us an assignment... not sure if that is how things work around here. Have you tried this by yourself?
     
  3. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    yes but i did not how can i begin :(
     
  4. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,771
    971
    have you ever written code before?
    Is this a school assignment?
    Have you talked to your teacher/professor and asked them for help?

    Its a very simple task for anyone that has ever had any microprocessor/coding experience
     
    aya aya likes this.
  5. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    We do not give answers to homework problems here. In order for us to help, we need you to try it on your own first, and then show us what you've dried so far. From there we have a starting point and can help you figure it out from there.

    Regards,
    Matt
     
    aya aya likes this.
  6. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,363
    Sounds like homework to me. Hence moved to Homework Help.
     
  7. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    i will trying to do it .. and i will give you what i do
     
  8. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    no im in a university but we did not write a ccs code and proteus design :(
    please help me
     
  9. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    how do you find this code ???
    it does not work correctly .. it missing something to get the output





    Code ( (Unknown Language)):
    1.  
    2. #include<16f877a.h>
    3. #FUSES XT,NOWDT
    4. #USE DELAY( CLOCK=4000000 ) /* Using a 4 Mhz clock */
    5. #include<lcd.c>
    6. #byte port_c=6 /* define the location of register port_b */
    7.  
    8.  
    9.  
    10. #define LCD_DB4   PIN_B4
    11. #define LCD_DB5   PIN_B5
    12. #define LCD_DB6   PIN_B6
    13. #define LCD_DB7   PIN_B7      
    14.  
    15. #define LCD_E     PIN_B2
    16. #define LCD_RS    PIN_B3
    17.  
    18.  
    19. void main()
    20. {
    21.       lcd_init();
    22.        set_tris_D(0x00); // set port_D to be outputs */
    23.      
    24.       set_tris_b(0x00); // set port_b to be outputs */
    25.       set_tris_a(0x07);//IDENTEFI PIN A0 A1  A2  AS AN INPUT
    26.       output_a(0x00);//TO DELETE ALL RABISH VALUES CAN APPEAR AT THE STARTING OF SIMULATING
    27.       output_b(0xff); // initialize All port_b outp/uts to be 1 */
    28.  
    29.  
    30.     while(1)
    31.     {
    32.  
    33.       if (Input(pin_A2==0))    //nand gate
    34.           {
    35.            
    36.             if (Input((pin_A1==0) && (pin_A0==0)) )
    37.                {
    38.                   //LCD_PutCmd ( CLEAR_DISP );
    39.                   LCD_gotoxy(3,3);
    40.                   printf(lcd_putc,"A NANDD B is " );
    41.                   Lcd_putc("1" );
    42.                   OUTPUT_HIGH(PIN_D0);
    43.                
    44.                }
    45.             else if(Input((pin_A1==1) && (pin_A0==1)))
    46.                {
    47.                  // LCD_PutCmd ( CLEAR_DISP );
    48.                  LCD_gotoxy(3,3);
    49.                   printf(lcd_putc,"A NANDD B is " );
    50.                   Lcd_putc( "0" );
    51.                   OUTPUT_LOW(PIN_D0);
    52.                }
    53.             else if(Input((pin_A1==0) && (pin_A0==1)))  
    54.                {
    55.                  // LCD_PutCmd ( CLEAR_DISP );
    56.                  LCD_gotoxy(3,3);
    57.                   printf(lcd_putc,"A NANDD B is " );
    58.                   Lcd_putc( "1" );
    59.                   OUTPUT_HIGH(PIN_D0);
    60.                }
    61.            
    62.             else if(Input((pin_A1==1) && (pin_A0==0)) )
    63.                {
    64.                 //  LCD_PutCmd ( CLEAR_DISP );
    65.                   LCD_gotoxy(3,3);
    66.                   printf(lcd_putc,"A NANDD B is " );
    67.                   Lcd_putc( "1" );
    68.                   OUTPUT_HIGH(PIN_D0);
    69.                }
    70.          }
    71.       else
    72.         {  if (Input((pin_A1==0) && (pin_A0==0))  )
    73.                {
    74.                  // LCD_PutCmd ( CLEAR_DISP );
    75.                   LCD_gotoxy(3,3);
    76.                   printf(lcd_putc,"A NOR B is " );
    77.                   Lcd_putc( "1" );
    78.                   OUTPUT_HIGH(PIN_D0);
    79.                }
    80.             else if(Input((pin_A1==1) && (pin_A0==1))  )
    81.                {
    82.                 //  LCD_PutCmd ( CLEAR_DISP );
    83.                  LCD_gotoxy(3,3);
    84.                   printf(lcd_putc,"A NOR B is " );
    85.                   Lcd_putc( "0" );
    86.                   OUTPUT_LOW(PIN_D0);
    87.                }
    88.             else if(Input((pin_A1==0) && (pin_A0==1)) )
    89.                {
    90.                //   LCD_PutCmd ( CLEAR_DISP );
    91.                  LCD_gotoxy(3,3);
    92.                   printf(lcd_putc,"A NOR B is " );
    93.                   Lcd_putc( "0" );
    94.                   OUTPUT_LOW(PIN_D0);  
    95.                }
    96.            
    97.             else if(Input((pin_A1==1) && (pin_A0==0))  )
    98.                {
    99.                 //  LCD_PutCmd ( CLEAR_DISP );
    100.                   LCD_gotoxy(3,3);
    101.                   printf(lcd_putc,"A NOR B is " );
    102.                   Lcd_putc( "0" );
    103.                   OUTPUT_LOW(PIN_D0);
    104.                }
    105.         }
    106.    }
    107.    
    108.    }
    109.  
     
    Last edited by a moderator: Jul 12, 2014
  10. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Does it give you any errors when you try to compile it? If so, what are they?
     
  11. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    no there is no error but the circuit in the proteus does not give output
     
  12. aya aya

    Thread Starter New Member

    Jul 10, 2014
    7
    0
    there is no output in the proteus circuit
     
Loading...