Newbie PIC program design help


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Newbie PIC program design help

    Your code in the PDF is not PicBasicPro. Sorry, I do not do JAL.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Dec 2011
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Newbie PIC program design help

    Quote Originally Posted by mackrackit View Post
    Your code in the PDF is not PicBasicPro. Sorry, I do not do JAL.
    Can you show me a PICBasic version?

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Newbie PIC program design help

    http://melabs.com/samples/PBP-mixed/onint.htm
    For a different chip.

    What version of PBP do you have?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Dec 2011
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Newbie PIC program design help

    Quote Originally Posted by mackrackit View Post
    http://melabs.com/samples/PBP-mixed/onint.htm
    For a different chip.

    What version of PBP do you have?
    PBP3 The demo version.

  5. #5
    Join Date
    Dec 2011
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Newbie PIC program design help

    Quote Originally Posted by ajhoward View Post
    PBP3 The demo version.
    Sorry for the noob answer...the pbp3 demo version doesn't support 12f675, no wonder I didn't hear back from you..sorry. I have proton ide 3.5.2.7. I have a code which close to what I need, but I think is something wrong with, because it doesn't seem to work, and it needs to modified a bit. I need it to have a 10 second delay before the flashing begins, and it needs to continue flashing until the switch goes open again, which would then return to sleep, ready for the next interrupt caused by the switch to begin the process again. This code doesn't seem to do anything...I have tried heaps of other codes on my pic and they work fine.

    'A change from Vdd to Vss on GPIO.4 will cause the 12F675 to wake up
    'It will then blink a LED 10 times and go back to sleep
    'Front end setup
    Device = 12F675
    Config WDT_OFF,PWRTE_ON,CP_OFF,MCLRE_OFF,BODEN_OFF
    TRISIO=24 'sets GPIO.3 and GPIO.4 as inputs and all others as outputs (or 011000)
    CMCON=7 'turns off comparator function [CMCON0=7]
    ADCON0=0 'no ADC - doesn't seem necessary but may be a good idea
    ANSEL=0 'no ADC input - IMPORTANT if using ports in digital mode
    VRCON=0 'turns off voltage reference to minimize sleep current
    INTCON=8 'Enables port change interrupt ie GPIE
    IOCB=16 'sets GPIO.4 for Interrupt on change [IOC=16]
    OPTION_REG.6=0 'INT on falling edge
    OPTION_REG.7=0 '00000000 WPU enabled,
    WPU=38 '00100110 = 38 set unused ports 1,2 and 5 tied to weak pull-up resistors
    'Define Variables
    wakeup VAR GPIO.4 'input, interrupt on change.
    LED VAR GPIO.0 'LED output
    x VAR Byte
    'Initial settings
    LED=0
    'Program
    START:
    INTCON.0=0
    DelayMS 100
    @ Sleep
    DelayMS 100
    For x= 1 To 10
    LED=1
    DelayMS 500
    LED=0
    DelayMS 500
    Next x
    GoTo START
    End
    Last edited by ajhoward; - 7th January 2012 at 09:47.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Newbie PIC program design help

    You did not hear back because you did not state a further problem...
    Anyway, if you have Proton then the best place to get answers is here
    http://www.protonbasic.co.uk/

    I am not real familiar with Proton syntax but this does look odd
    TRISIO=24
    Should there be a hex modifier in there someplace?
    Dave
    Always wear safety glasses while programming.

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