Frequency Counter


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Break it down, make it simple, build it back up.
    Erase the chip, Blank check it, make sure both program and eeprom space reads back as $ff, then try this:

    Code:
    @ DEVICE PIC12F683, INTRC_OSC_NOCLKOUT
    @ DEVICE PIC12F683, WDT_ON
    @ DEVICE PIC12F683, PWRT_ON
    @ DEVICE PIC12F683, MCLR_OFF
    @ DEVICE PIC12F683, BOD_ON
    @ DEVICE PIC12F683, CPD_OFF
    @ DEVICE PIC12F683, PROTECT_OFF
     
    temp var byte
    temp2 var byte
    ledpin var gpio.(pick a pin)
    output ledpin
    
    main:
    'show a heartbeat for the program on an LED to make sure something is happening
    temp2 = temp2 + 1 : ledpin = temp2.0
    
    for temp = 0 to 255 : write temp, temp : next temp : goto main
    end
    Hook an LED to a pin, let it blink a few times, then do a readback on the PIC. That should tell you if your eeprom statement is working in the first place. Then build it back up...

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The internal oscillator is set @4MHz by default, you can set OSCCON register to go to 8MHz.

    As usual i'll suggest you to use a internal Timer (TMR0 or TMR1) as counter. Yes you'll have to use the dedicated pins for that... no harm at all, you have tons of benefits.
    1. it runs in background
    2. it's more accurate
    3. use less code space
    4. more flexible

    This PIC have this cute and handy CCP module, so you'll be able to generate the PWM signal really easy using HPWM or by setting the according register manually. This also run in background.

    HTH
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Audio Frequency Counter
    By mister_e in forum Code Examples
    Replies: 8
    Last Post: - 29th July 2009, 08:25
  3. frequency counter help and pointers
    By comwarrior in forum General
    Replies: 2
    Last Post: - 30th June 2009, 11:51
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Frequency Counter using PIC and PicBasic
    By PICtron in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 28th January 2005, 06:20

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts