Re: Digital touch Screen Combination lock
when you write to lata you write directly to the porta output latches, only the pins declared as outputs are connected to the pins via the trisa "switch".
when you write to porta you write directly to the porta output latches, only the pins declared as outputs are connected to the pins via the trisa "switch".
when you read porta you read the digital logic level of all the porta pins , analog pins always read low
when you read lata you read the porta output latches value not the digital logic level of all the porta pins
when you write to a lata.pin you read the porta output latch value into the alu then,
logically AND it with that pins bit value as 0 to CLEAR the pin
or
logically OR it with that pins bit value as 1 to SET the pin
then write the result back to the porta output latches
when you write to a porta.pin you read the porta pins value into the alu then,
logically AND it with that pins bit value as 0 to CLEAR the pin
or
logically OR it with that pins bit value as 1 to SET the pin
then write the result back to the porta output latches
if you did lesson one you would have noticed that port pins are subject to real world load conditions and that reading the pin value is not always what you wrote to it
you need to allow for pin loading
lesson two shows you can set and clear an analog pin made output but you can never read an analog pin properly
lesson three shows you can read and write to output latches but they may not represent the pin values of that port they are always what you last wrote to the latch

the diagram is for 1 pin
Last edited by richard; - 18th August 2020 at 12:11.
Reason: edited to English not gibberish
Warning I'm not a teacher
Bookmarks