Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic16f628a interfaced with 7segment

Status
Not open for further replies.

nxt_

New Member
Dear All,
Greetings,fisrt of all i want to thank adminstrators and founders of this wonderfull website. you guys can't imagin how you are making difference. whatever you or any other blogs online that do the same thing. Thanks. anyhow i got avery simple problem in avery simple project, i don't know the reason. mayb because its my first time to use the 16th family. i usually use 18th.

i am trying to interface pic16f628a with seven segment display common cathod. my wiring is okay (i guess).. -segment is attatched to portb with series resistors 300 ohm, the program is supposed to display the number of high pulses enter PORTA.0, from 0~9 i write it in picbasic (proton). when i start the program it just display 0 as there is no high pulses enter porta.0, although i keep connect porta.0 to 5v and no respond. and onther issue; is uptill now 3 ics are damaged. don't know the reason. the connection are okay . Vss to gnd, vdd to 4.5v, mclr to 4.5v, crystal is 4mhz in the osc1,osc2 pins and 10kpulldown resistor on porta.0 and the rest are the button and the 7segment. so any help? is there any addiotional intialization i should do before i start the program.

Many Thanks For Your Attention.
And greetings to Nigel :)
 
Device 16F628A
XTAL 4
clrf TRISA
clrf PORTA
clrf TRISB
clrf PORTB
TRISB=0x00
PORTB.0=0
PORTB.1=0
PORTB.2=0
TRISA.0=1



DelayMS 200
main:
PORTB=0xbf
If PORTA.0=1 Then
GoTo one
Else GoTo main
EndIf
one:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xb0 : GoTo check ;1
Else GoTo one
EndIf

check:
PORTB=0xb0
If PORTA.0=0 Then
DelayMS 500 :GoTo two
Else GoTo check
EndIf

two:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xdb: GoTo check2 ;2
Else GoTo two
EndIf

check2:
PORTB=0xdb
If PORTA.0=0 Then
DelayMS 500 : GoTo thre
Else GoTo check2
EndIf


thre:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xcf : GoTo check3 ;3
Else GoTo thre
EndIf

check3:
PORTB=0xcf
If PORTA.0=0 Then
DelayMS 500 :GoTo four
Else GoTo check3
EndIf

four:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xe6 : GoTo check4 ;4
Else GoTo four
EndIf

check4:
PORTB=0xe6
If PORTA.0=0 Then
DelayMS 500 :GoTo five
Else GoTo check4
EndIf

five:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xed : GoTo check5 ;5
Else GoTo five
EndIf

check5:
PORTB=0xed
If PORTA.0=0 Then
DelayMS 500 :GoTo six
Else GoTo check5
EndIf

six:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xfd : GoTo check6 ;6
Else GoTo six
EndIf

check6:
PORTB=0xfd
If PORTA.0=0 Then
DelayMS 500 :GoTo seven
Else GoTo check6
EndIf

seven:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0x87 : GoTo check7 ;6
Else GoTo seven
EndIf

check7:
PORTB=0x87
If PORTA.0=0 Then
DelayMS 500 :GoTo eit
Else GoTo check7
EndIf

eit:
If PORTA.0=1 Then
DelayMS 500 :pORTB=0xff : GoTo check8 ;6
Else GoTo eit
EndIf

check8:
PORTB=0xff
If PORTA.0=0 Then
DelayMS 500 :pORTB=0xff : GoTo creset
Else GoTo check8
EndIf

creset:
If PORTA.0=1 Then
DelayMS 500 : GoTo main
Else GoTo check8
EndIf
 
birdman, microswitch attatched to porta.0 with 10kOhm pull down resistor. Thx for your reply

Rajbex, You Are The Man (-_*), It work out. thanks for you attention :)... another question plz; what if i want to enable the internal oscilator so that i can reduce the cost for buying 4mhz crystal. (is that okay).. and what is the advantage and disadvantag of the internal oscilator ( as you see it is simple project just 7 segment display. awaiting Your Prompt Reply :).
 
h**p://www.coolcircuit.com/circuit/basic-control-motor/motor-controller.GIF , could any one please check this schematic and tell me what is the purpose of putting two 100nf capacitors after the motor. and what is the middle wire between them for?. is the two capacitors for the protection from high start current occur when the motor starts? just smoothing?. if that is right so my question will be what is the middle wire between them?.. onther question. if i want to replace the transistor in the schematic by irf740; how to calculate 'R' base. i know there is arelation between the Drain source currernt ,Gate charge, and temprature. i need standard equation so that i can apply it on any mosfet transistor so that i can reach the maximum possible effecient switching device.

Awaiting Your Prompt Reply,

Thanks To You All.
 
Status
Not open for further replies.

Latest threads

Back
Top