Johan, You may want to try writing your own 250ms delay routine (probably as a chunk of #asm code) and get rid of the delay_ms() calls. I had NO END of problems trying to get anything working on a system I'm working on now until I did that. It seems delay_ms and delay_us screw with a lot of things (or at least I think so), but I can't find documented anywhere how they work exactly. I have not gone looking for the source code for those functions yet. Anyway, this may not fix your problem, but it's a thought. Dale On Mon, 17 Jul 2000, Johan Fredriksson wrote: > I've tried this on 12C509A and 16F877 with the same result. I'm just looping > forever reading two pins and sending a text on RS-232. I'm using CCS > compiler for coding. > > while (-1){ > if (INPUT(PIN_B3)){ > printf("B3 High\n\r"); > } else { > printf("B3 Low\n\r");} > delay_ms(250); > > if (INPUT(PIN_B4)){ > printf("B4 High\n\r"); > } else { > printf("B4 Low\n\r");} > delay_ms(250); > } > > Pin B3 gets a logic 1 (4.95V) or 0 (0.01V) and pin B4 is always high. The > input to B3 comes from a Hall-effect switch. When it detects a magnet it > gows low and when magnet is removed it goes, of course, high again (pull-up > to +5V and the Hall acts like a transistor driving to ground). The logic > output is OK all the time. > > When removing the magnet so it goes high again the PIC is dead. But not > compleatly dead! If I add the magnet again so it goes low the PIC continues > from where it was again. > > Anyone having some hints or ideas? I'm very confused now :-) > > /Johan > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements > --- The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!" (I found it!) but "That's funny ..." -- Isaac Asimov -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements