problem

Thread Starter

aya aya

Joined Jul 10, 2014
7
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
 

mcgyvr

Joined Oct 15, 2009
5,394
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
 

DerStrom8

Joined Feb 20, 2011
2,390
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
 

Thread Starter

aya aya

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





Rich (BB code):
#include<16f877a.h>
#FUSES XT,NOWDT
#USE DELAY( CLOCK=4000000 ) /* Using a 4 Mhz clock */
#include<lcd.c>
#byte port_c=6 /* define the location of register port_b */



#define LCD_DB4   PIN_B4
#define LCD_DB5   PIN_B5
#define LCD_DB6   PIN_B6
#define LCD_DB7   PIN_B7       

#define LCD_E     PIN_B2
#define LCD_RS    PIN_B3 


void main()
{
      lcd_init();
       set_tris_D(0x00); // set port_D to be outputs */
      
      set_tris_b(0x00); // set port_b to be outputs */
      set_tris_a(0x07);//IDENTEFI PIN A0 A1  A2  AS AN INPUT
      output_a(0x00);//TO DELETE ALL RABISH VALUES CAN APPEAR AT THE STARTING OF SIMULATING
      output_b(0xff); // initialize All port_b outp/uts to be 1 */


    while(1)
    {

      if (Input(pin_A2==0))    //nand gate
          {
            
            if (Input((pin_A1==0) && (pin_A0==0)) )
               {
                  //LCD_PutCmd ( CLEAR_DISP );
                  LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NANDD B is " );
                  Lcd_putc("1" );
                  OUTPUT_HIGH(PIN_D0);
               
               }
            else if(Input((pin_A1==1) && (pin_A0==1))) 
               {
                 // LCD_PutCmd ( CLEAR_DISP );
                 LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NANDD B is " );
                  Lcd_putc( "0" );
                  OUTPUT_LOW(PIN_D0);
               }
            else if(Input((pin_A1==0) && (pin_A0==1)))  
               {
                 // LCD_PutCmd ( CLEAR_DISP );
                 LCD_gotoxy(3,3); 
                  printf(lcd_putc,"A NANDD B is " );
                  Lcd_putc( "1" );
                  OUTPUT_HIGH(PIN_D0);
               }
            
            else if(Input((pin_A1==1) && (pin_A0==0)) ) 
               {
                //  LCD_PutCmd ( CLEAR_DISP );
                  LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NANDD B is " );
                  Lcd_putc( "1" );
                  OUTPUT_HIGH(PIN_D0);
               }
         }
      else
        {  if (Input((pin_A1==0) && (pin_A0==0))  )
               {
                 // LCD_PutCmd ( CLEAR_DISP );
                  LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NOR B is " );
                  Lcd_putc( "1" );
                  OUTPUT_HIGH(PIN_D0);
               }
            else if(Input((pin_A1==1) && (pin_A0==1))  )
               {
                //  LCD_PutCmd ( CLEAR_DISP );
                 LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NOR B is " );
                  Lcd_putc( "0" );
                  OUTPUT_LOW(PIN_D0);
               }
            else if(Input((pin_A1==0) && (pin_A0==1)) ) 
               {
               //   LCD_PutCmd ( CLEAR_DISP );
                 LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NOR B is " );
                  Lcd_putc( "0" );
                  OUTPUT_LOW(PIN_D0);  
               }
            
            else if(Input((pin_A1==1) && (pin_A0==0))  )
               {
                //  LCD_PutCmd ( CLEAR_DISP );
                  LCD_gotoxy(3,3);
                  printf(lcd_putc,"A NOR B is " );
                  Lcd_putc( "0" );
                  OUTPUT_LOW(PIN_D0);
               }
        }
   }
   
   }
 
Last edited by a moderator:
Top