In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Electronegativity wrote: I got home after midnight tonight, but had to try it. With the comparator hooked up to nothing it actually generates pretty random bits, but it seems to favor 0 a little over 1. I have the port A registers attached to 4 diodes and am sampling the comparator output with the following code: GetNumber sb rb.0 jmp BlueGreen jmp RedYellow BlueGreen sb rb.0 jmp Blue jmp Green RedYellow sb rb.0 jmp Red jmp Yellow Blue mov LIT, #%0001 ret Red mov LIT, #%0010 ret Green mov LIT, #%0100 ret Yellow mov LIT, #%1000 ret After returning it moves the value in LIT to ra and lights whatever diode corresponds to the bit that is set. The favoritism of zero over one manifests itself as the blue diode being lit a little bit more than the others. Grounding one of the two comparator inputs will consistently cause it to choose the other input as high. Now here's the odd part: When I momentarily tap Vdd to pin rb.2 (through a resistor) it correctly lights the yellow diode, but then it stays lit for about 24 seconds before returning to semi-randomness. This is at 4Mhz with the SX key detached. It takes longer for slower clock speeds out to around 38 seconds at 32kHz. If I tap rb.2 with Vdd/2, it stays lit for about half the time before rb.0 starts flickering again. Just in case you thought this couldn't get any more bizzarre, when I tap rb.3 with Vdd/2 the comparator output goes to zero and stays there indefinitely. I have attached the rest of the code. The circuit is nothing more than an SX18AC/75 powered by an L7805 and Guenther's recommended capacitance circuit (without the back EMF protection diodes). There is also a programming header and 4 diodes hooked up to the ra register. with a 570 ohm resistor on the ground side to keep them from frying. The voltage divider is constructed from 2 4.7k resistors, and there is a 10k resistor plugged into Vdd. -Electronegativity signing off. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=90112#m90565 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)