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.

heelppp!!!!! 16f628 problem

Status
Not open for further replies.

zhaniko93

New Member
Hello.
I have made a small project in Mplab IDE on 16f628a and tryed everything in Proteus ISIS. Everything works fine but when I build everything in reality, when I press 'n' on PC, i.e. RA0 is set and motor starts working for maybe 0.2 sec, then is suddenly stops, but pic isn't reseted, becouse CCPR1L is kept on same level. P.S. I have used Breadboard for my project, hope this doesn't make any problems. I attached .asm files, and ISIS file, and here's schematic:
**broken link removed**
 

Attachments

  • JaKo 16f628 NEW.zip
    21.3 KB · Views: 105
  • Dzrava.asm
    4.7 KB · Views: 123
  • pulti.asm
    4.7 KB · Views: 127
I have selected _MCLRE_OFF which means that I use MCLR like a ordinary pin
P.S. hello Burt :))
 
Last edited:
In your post it's floating. Your not using it. as any thing? That can cause reset......... when the chip starts. And what your saying looks like it is resetting.
 
no, no, I have set MCLR pin to be used as a normal pin, I have disabled MCLR reset. from datasheet: MCLR: When configured as MCLR, this
pin is an active low Reset to the device. MCLRE configuration bit sets RA5 functionality. btw, If I remove the 9v battery from circuit, everything works fine. so it's not MCLR's fault
 
Now we no. How are hooking up the 9 volts? Is it being regulated to 5 volts for the PIC? Or are you trying to run the motor with it.?
 
pin voltage is supported directly from PC usb cable and 9v battery is connected as in a schematic, it only tries to run motor. I have connected the battery's - (minus) part to ground.
 
According the 16F628 datasheet, CCPR1L is in an unknown state on Power-on-reset and is unchanged for all other resets. (See table 9.2).

You haven't mentioned whether you have disabled the Watch Dog Timer (WDT). If enabled, it will cause a reset after less than a second of running, then again, and again...

You either have to disable WDT via configuration bit or you must execute a CLRWDT instruction every few milliseconds in your program...if WDT is not necessary to your design you should disable it.

Mike
 
I haven't mentioned but I uploaded asm files, I have disabled WDT (_WDT_OFF), and anyway, when I remove battery from circuit, everything works fine! everything is OK until I press 'n', I think that when current goes through transistor, something happens, maybe ground potential is increaced or something like that becouse when I connect transistor GATE to ccp pin, when duty cycle isn't enough to run motor, nothing happens but when motor starts rotating, then ccpr1l suddenly inrceaces very much, maybe up to 100-150, then it suddenly stops or goes up to about 200
 
yes they are, it's hexfet irf530n, not motor, I mean, +9v---MOTOR---Transistor Source -- Ground which ground is tied to +9v battery ground
 
OK...is the negative side of the +5V supply tied to the same ground as the negative side of the +9V motor supply?
 
You may need something like this
 

Attachments

  • MotorSW.PNG
    MotorSW.PNG
    41.6 KB · Views: 158
Last edited:
Jon Wilder
Yes I have
be80be
This didn't work ether :(
 
Last edited:
Take a look at pics
 

Attachments

  • Picture 001.jpg
    Picture 001.jpg
    64 KB · Views: 149
  • Picture 002.jpg
    Picture 002.jpg
    66.3 KB · Views: 149
  • Picture 003.jpg
    Picture 003.jpg
    54.3 KB · Views: 151
  • Picture 004.jpg
    Picture 004.jpg
    74.6 KB · Views: 136
  • Picture 005.jpg
    Picture 005.jpg
    67.7 KB · Views: 136
  • Picture 006.jpg
    Picture 006.jpg
    37.8 KB · Views: 133
  • Picture 007.jpg
    Picture 007.jpg
    48.9 KB · Views: 139
  • Picture 008.jpg
    Picture 008.jpg
    86.9 KB · Views: 144
  • untitled.JPG
    untitled.JPG
    308.2 KB · Views: 166
and I think that no reset is done, because on any reset CCPR1L is left unchanged and in my case, it goes to 0 or up to 150 and when I click w again, it jumps to 250..... or to 0
 
I use this to draw sch it fast and simple **broken link removed**
 
Last edited:
Bill you use Proteus ISIS ? If so what do you think up it? I like real hardware myself.
 
You may need something like this

Burt,
On your circuit
Check the bias current path from the +B thru the PNP forward biased diode and the clamp diodes in the PIC.???
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top