-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submission for example programs: Falling Edge Detector #66
Comments
@frodare Hi, I just stumbled over this, should the GPIO read 0xf or 0x1? If ladder I could quickly make the change. Cheers. |
@stfwi It has been long enough since I built this mod that I am not sure. I think I wanted to represent 1 as 0x1, but at some point it was outputting 0xf. |
@Zexks
Comment/uncomment the second line to switch between digital/analog modes respectively. Register Just read more into the issue, saw this:
I tried this program:
Once |
Hey guys, independent of the current PR addressing the 0x1/0xff digital values, I would recommend to use the MOV a, pb
AND a, 0xff ; or CMP a, 0x00
JNZ powered
unpowered:
; do stuff
JMP cond_done
powered:
; do stuff
cond_done:
... That way it does not matter if the port is in digital or analog mode. (A compare instruction is like a subtraction, except that it does not change the register, but sets or clears Keep it up guys, cheers,- |
Yeah, I've seen the Wiki page for how This snippet does work, and it's good for preserving the 0x0-0xF value of that port if it's being used in the CMP pb, 0x00
JNZ powered
unpowered:
; do stuff
JMP cond_done
powered:
; do stuff
cond_done:
... There's also a case to be made regarding input to use the (as far as I can tell) unused upper nybble of the ADC register to have a "legacy" mode for Digital, where the registers read out |
Hi, aye, totally, compare-zero is the best thing for single value query. The unused port bit usage is also a good aspect. The PR is related to the descriptions in the wiki, hence the change to 0x1. Similar to the fewer cycles needed, I am wondering if the bit-testing instruction mentioned could be interesting for the new (if accepted) IDR register. To latch and check ports in one go, e.g. loop:
WFE
MOV a, idr ; latch all I/O port states in lower nibble
AND a, match
JNZ case_b
case_a:
; do a
JMP done
case_b:
; do b
done:
... Bit testing replaces that with a boolean result in loop:
WFE
BIT idr, match
JNZ case_b
case_a:
; do a
JMP done
case_b:
; do b
done:
... Similar to the compare-zero - without clobbering a register. |
Assuming this is the mentioned proposal:
I assume that If this is what it'd do, I see how it's not possible to do that with In the second quote, I assume the comparison referred to here, |
mov ports, 0010b
start:
cmp pb, 0
jz start
wait:
cmp pb, 0
jnz wait
mov pf, 1b
mov c, 5
loop:
dec c
jnz loop
mov pf, 0
jmp start
Used this for several machines that require crafting mods to do a single craft at a time. AE2 has a setting called blocking mode but other mods require redstone signals between crafts.
Still seems to have issues with recognizing '1' in the cmp command. tried with 0xff but couldn't get that to work either. Had to go off 0 checks.
The text was updated successfully, but these errors were encountered: