I'm by no means an expert but I think I can cover these. ----- Original Message ----- From: John De Villiers To: Sent: Tuesday, October 12, 1999 7:03 AM Subject: [PIC's] Some Explanations please > I've gone through the picNpoke tutorials, and now i have a few questions. > > 1) What does open collector output mean. What should i consider in the > circuit diagram for this pin. Open collector was used for bus interfacing before 3 state outputs came around. 3 state ouputs (like the normal PIC pins) have (surpisingly) 3 states, high (+5V), low (GND) and High impedance (a.k.a High-Z, Z etc). The high and low states are used when the pin is an output, the High impedance when the pin is an input. This means multiple devices can be connected and inactive devices simply go High-Z. Open collector provides a similar end result with a different method. Unfortunately you'll have to get someone else to explain exactly what it is. If your using it as an input pin then noi modifications are needed. If you're using it as an ouput you need a pullup resistor. A pullup resistor is a resistor placed between the pin and +5V, this means that when the pin is high it w3ill be "pulled up" to a full +5V, otherwise it's simply low. > 2) What does weak pull-ups mean. Same thing as in open collector. Don't know quite whjy there weak, or when you would use them\not use them. > 3) Is there a latency between setting a pin to high and when it actually > does go high, and if there is, what should my minimum time delay be if i > want to take it high and low very fast - ie 400ns ( 10 MHZ low instuction > immediately after a high ) Due to the instruction pipelining of the PIC, pins are written at the end of each instruction cycle, so there is that lag, but that's transparent from a coding point of view as all writes happen at the same point in the instruction cycle.However, reads occur at the start of the instruction, Hence reads should not directly follow writes in general. There is also a delay added to the voltage change on the actual pin. This is due to the capacitance on the pin and can be limited by a series resistor on the output pin. I have only seen this mentioned when the Clock Tick on external pulse feature is used and thus sub 1 instruction rise falls are neccesary. I'm pretty sure you should have no problems with sequential writes at only 10MHz. > 4) if RB7:4 is set to interrupt and RB5&4 are to outputs, will i > inadvertently generate an intterupt when i write to bits 4 and 5. No, if a pin is set to output it will not set the appropriate interrupt flags (I gather it just doesn't set them) and no interrupt will be generated. > 5) does anyone have a 5digit bcd to 16bit binary routine please. My mind is > going numb trying to work that one out. i can do it on paper though Microchip Application Note 526 - PIC16CXXX Math Routines has routines for 2bit binary -> BCD and 5bit binary->BCD in both directions. > > 6) I want to use a pic for a dimmer switch. what is the easiest way to tap > 5vdc from a 220vac line. I want to mount it inside the light switch cover if > at all possible. This is not my area of expertise. Inside a lightswitch covber might be a bit of a tall ask. From memory, you need a transformer to get to about 15V AC, A bridge rectifier to get 10-15V DC and a 5V regulator (prob. need a resistor before or lower the input). But, I could be wrong. Not sure about the lightswitch, depends how big it is. > > thats all for now > > thanx in advance > > John