0

Hi
I am facing one small problem please send me suggestion for that Problem as follows
I have written one code in C for 8051 to use one port as input port & other one as out port.This is done by push button.For example I use P1.0 as in put & P0.1 as out put that is when i press push button connected to P1.0 out put come from P0.1 & when i release button out put get off but If I want to retain that out put till next press of same button whats your suggestion to modify my program please reply Thank You Have good time
please reply

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by wildgoose
0

Code, what code?

If I understand your need you need edge triggering. Assuming high until pull down upon edge trigger.

Here's some C code. You need to create an assembly language equivalent!

// global values
byte sw = 0xff;
byte swEdge = 0x0;
// Keyboard input loop
byte sin, swup, swdn;

sin = getPort();
swEdge = sw ^ sin;      // Save difference that's the edge
swUp = swEdge & sin;  // Switch just released
swDn = swEdge & (sin ^ 0xff);  // switch just depressed
sw = sin;                       // New bits

Edited by wildgoose: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.