2020-10-21 06:24 AM
HI
i have connected a stm8s003f3p6 to a common anode 7segment.one of segments has connected to PC7 gpio and it is always on because PC7 does not drive to high level voltage.it would be appreciated if help me?
thanks
2020-10-21 09:17 AM
I suppose You have configured PC7 as Open Drain (OD), the anode to VCC/VDD and catode of the segment, to PC7 trough a resistor.
Are you sure to have configured the PC7 I/O as output in Open-Drain mode?
2020-10-21 11:11 AM
thanks to your help
i have configured PC7 as push pull .PC7 has been connected to segment in direct mode without any resisitor.do you think that i should set PC7 in open drain mode?
2020-10-22 12:09 AM
Yes, I suggest you configure PC7 in Open Drain output and, above all, I also advise you to put a resistor in series the cathode of each segment in order to limit the current within the maximum allowed by the specifications of the microcontroller and therefore stress the output.
For example, if the VCC is 5V and the display is of the Red LED type, supposing to give 10mA to each segment, the determination of the resistor is: RSeg = (VCC-VF-VO_sat) / ILed.
where :
VCC = Voltage on the anode of the disgit
VF = Voltage drop on the LED diode of the segment which for red displays is typically 2.2V
Even neglecting the VO_Sat of the PC7 output: (5-2,2) /0.01 = 280 ohm which you can easily round to 270 ohm.
The voltage on the digit anode, must be that of the microcontroller power supply.