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.

PIC12F675 and PIC12F683

Status
Not open for further replies.

rthuey

Member
is there someone state side that has a programmer that can put the program at the end of **broken link removed** page onto 3 pics for me?

using the pic may help me around an issue i have been having on a circuit. can't really shell out for the hardware at this time.
 
Do you have the complete program that you need burned into the PIC? Have you simulated it? Have you compiled it?

How do you propose to work the transfers? I suspect there might be some re-do's, so location might make a difference. Where are you located?

John
 
Here I compiled the code for you test1 is for 12f683 ans test2 is for 12675 You can Pm me if you want two chips burned
 

Attachments

  • PBP_code.zip
    5.9 KB · Views: 236
@jpanhalt to my knowledge everything i needed was on that page. i have not simulated it. i have not compiled it. i figure USPS and SASE envelope/small box to whomever can do it for me. I am ordering the PIC's along with some other things i need from Digikey today. Hopefully there won't be a need for a redo. The program was compiled and tested by the originator of that page (i have emailed him) in the circuit described on same page. i am located in Manhattan.


@be80be thank you. sorry. i should have typed that script into my post to save some typing on your end. sent PM
 
You no that code has mistakes in it. I'm not saying it will not work but this part is not right.

Code:
'this variable holds (buffers) the previous state of the sensor
 sensorPrev VAR BYTE
 sensorPrev = tilt  ' tilt is not define as anything and is not used.
 
@jpanhalt to my knowledge everything i needed was on that page.

That page refers to placing an LED on PortB.4. The schematic shows an LED on GP5 (pin2) of the 12F675. The 12F series have GPIO. Thus, reference to "PortB" made me think there was a different version somewhere else for the 12F series.

I can only read, at best, a little Assembly, so maybe the correct pin assignment was somewhere else in the code. Sorry to raise that concern unnecessarily.

John
 
The switch reading part will tell you it's on the move the code is in basic pic basic pro. I changed it to match the pins on a 12f683 or 12f675 I didn't turn off the ADC or the comparator.

John who ever wrote that page was thinking one thing and posted something else.
They talk about
One-shot: While remaining in a low power mode i.e. running on a 32 KHz watch crysta

And
Connect the sensor to an interrupt line on the microcontroller or CPU.

But the sample doesn't match the circuit. And I was half asleep when I complied it this morning and didn't turn off the ADC or the comparator, But after that fix it will work as planned by the author.
 
Last edited:
That page refers to placing an LED on PortB.4. The schematic shows an LED on GP5 (pin2) of the 12F675. The 12F series have GPIO. Thus, reference to "PortB" made me think there was a different version somewhere else for the 12F series.

I can only read, at best, a little Assembly, so maybe the correct pin assignment was somewhere else in the code. Sorry to raise that concern unnecessarily.

John

and the pictured breadboard example has the LED on GP4 (pin 3) tied up to 3v with no resistor in sight. Where the schematic shows it tied down to ground with the help of a resistor.

is there a simulator that will help me try this out before i put any one out of any more of their own time. i found this on the internet, and you know everything on the internet is true. and complete. thought i was good to go.

my apologies i got excited when i found it. the other circuits i had been trying were more in-depth. but non functional where i was trying to use them.


@be80be the sensor appears to be connected to the interrupt line INT (pin 5). As the manufacturer suggested. Then the manufacturer says to look for an interrupt while running in a low power mode off the/a watch crystal. is my take on that. which seems sensible.
 
rthuey It will work your missing the point the code on that page is a sample it's not what the author is using with interrupts and stuff. But it's no big deal to change that so they work to.

But I need to no how you want to use it with a 32khz crystal and let it start up when there a interrupt.
 
Last edited:
See this code is for a 32khz crystal but this mess up the delays we will need to write are own which I would say that's why it was not in the sample.

Code:
@ device  pic12F675, LP_OSC, wdt_on, mclr_on, protect_off
'Place the sensor is on GPIO.2
 sensorPin  VAR GPIO.2  :  TrisIO.2=1

 'Place a LED on port B.4
 testLED VAR GPIO.1 : trisio.1 = 0 : testLED = 0     

 'this variable holds (buffers) the previous state of the sensor
 tilt VAR BYTE
 sensorPrev VAR BYTE
 sensorPrev = tilt    ' this is not used i would say they uesd it in a 
                      'interrupt handier

 'a counter- increases when the sensor moves
 sensorCount VAR WORD
 sensorCount = 0

 'a couter - increases on every loop iteration
 gapcount VAR WORD
 gapcount = 0

 'this variable determines how often we check for sensor changes.
 gap VAR WORD
 gap = 500
 CMCON = $7
 ANSEL = $0
 'take a breather
 PAUSE 1000

 'beginning of main loop routine
 main:

 gapcount = gapcount + 1

 'we use this if statement to activate the sensor routine -
 '- once every {gap} cycles. In this code - once every 500 loops.

 IF gapcount > gap THEN

    'reset the counter
    gapcount = 0

     'if the sensor pin has changed since last checked
     IF sensorPin <> sensorPrev THEN
          'increment by 5 unless the counter is already very high
          IF sensorCount < 50 THEN
              sensorCount = sensorCount+5
          ENDIF
     'else if the sensor did not change states
     ELSE 
         'slowly decrease the sensor unless its already at 0
         IF sensorCount> 0 THEN
             sensorCount =  sensorCount-1
          ENDIF
     ENDIF

     'if the sensor moved repeatedly - we have real motion!  
     IF sensorCount> 25 THEN
      testLED = 1
     ELSE 
      testLED = 0
     ENDIF

     'set the sensor buffer to current sensorPit, toward next check
     sensorPrev = sensorPin
 ENDIF


 'loop again...
 GOSUB main
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top