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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.