Why won’t the following simple routine work? Please read my last post if more background info is needed. The MPU is a baby “O”, and most of the code, either “C” or snippits of embedded “asm” work perfectly. The “sbic” instruction in the test code below, should test PB4 and skip the “cbi” instruction if PB4 is grounded, thus extending the pulse depending on the number of nop’s. It does not matter whether PB4 is at 5V or ground, no change is noted. Comment the “cbi” instruction, and eurika, the pulse width increases.
#define F_CPU 20000000UL
#include <stdio.h>
#include <util/delay.h>
#include <avr/io.h>
int main(void) {
DDRB = 0x20; // Set PORTB data dirction register for PB5
while(1) {
PORTB |= 0x20;
PORTB &= ~0x20; // Scope sync pulse. (PB5)
asm(" sbi 5,5"); // Assembly instruction that also sets PB5 high.
asm(" sbic 5,4"); // Should test PB4 and skip if zero! (won't work)
asm(" cbi 5.5"); // Comment this instruction and the pulse width
// will extend by about .25 microseconds.
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop"); // If PB4 is zero, the pulse should be extended.
asm(" cbi 5,5"); // Clear PB5.
_delay_ms(.1);
} // End of "while".
} // End of "main".