Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Confused with this !

Status
Not open for further replies.
Dr_Doggy is right. You have to set the values at RC0 & RC1 so they go to the inputs of the 1st NAND gate. Then you test the output of the 1st NAND gate at RD0....

You have to repeat the test 4 times for the combinations of 00, 01,10 11. AFter that you have to repeat the same test for the rest of the other 3 NAND gates.....
NAND GATE TEST.PNG


Allen

p/s "code tag" doesnt work on my PC (XP). Does others have the same problem?
 
I am dropping out of this thread. I don't understand the OP's logic. Allen (absf) has provided a schematic that will work and both he and Dr_Doggy have provided the testing proceedure but the OP is doing things like testing the inputs to the gates and expecting that information to say if the gate is working. At no point does he try to setup the input conditions. This is why I asked him the questions "How would you test a nand gate." and do you know which are the inputs and output of a NAND gate. I would expect anyone doing even the most basic electronics course to know what a NAND gate does. If he does not understand what he is suppost to be testing he is not in a position to start writing code. I think the OP needs to re sit the course.

Les.
 
#include <p16f877A.inc>
org 0x00

banksel TRISC
clrf TRISC ; Make the PORTC as output // ok
banksel PORTC
//here you dont test RC0 but you have to set/clear it using bsf/bcf instruction
// here BCF PORTC,0 ;RC0=0
// and BCF PORTC,1 ;RC1=0

;btfsc PORTC,0 ; Check bit0 in PORTC and skip next instruction if bit0 = 0 .
; goto p ; This be skipped if bit0 = 0

;btfsc PORTC,1 ;Check bit1 in PORTC and skip next instruction if bit1 = 0 .
;goto k ; This be skipped if bit1 = 0

;k
banksel PORTD ; choose PORTD
movlw 80h
movwf PORTD ; make PORTD bit 7 as input while 0~6 output

btfss PORTD,7 ; if RD7=1 then skip to next test
goto ERROR
// continue to test for 2nd condition........ etc
ERROR:
Lite the "BAD" LED

end

Allen
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top