New to coding - Please look at my code thanks!


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I appreciate it guys. Like I said, first time coding.

    I missed somethings since I did it at 2am last night = half asleep

    Anyhow yes, 12F683

    Will I have any problems with bouncing on the button?

    and I haven't found/read any good information on how to setup the INTCON or INTOSC on the chip.

    THANKS A LOT GUYS! only error I get now is the INTCON and that one I knew would show up.

    Really thanks a bunch.
    Last edited by erice1984; - 4th July 2007 at 00:37.

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


    Did you find this post helpful? Yes | No

    Default

    did you tried with the datasheet ? For the internal OSC, have a look for OSCCON register

    Ok, what do you need to do exactly? There's more than one way to skin a cat anyways....
    Steve

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

  3. #3
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I am worried that the PIC will only be able to deal with one loop at a time, and if that is the case then...

    When fans come on it will be stuck for 10 seconds doing one thing when maybe the user wants to turn the system off.

    So if that is the case, then I may need to make use of interrupts.

    and I will look at the datasheet in a little while, racing in Forza 2 ATM, damn Ferrari is hard to drive with AI at hardest difficulty.

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


    Did you find this post helpful? Yes | No

    Default

    could be worst if you had a Pagani Zonda on hand

    So now, YES interrupts would be handy INDEED.
    Steve

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

  5. #5
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    i hate those cars, the turn in on them is horrible! worse than a car like the impreza that was designed to have understeer issues!

    P.S. when you have understeer problems you have to purposely induce a drift/power slide to get the damn car to turn. I know I drive an Impreza in RL, a lot easier to get it to oversteer if you have the balls to go into a turn waaaay too fast, and punch the brakes to the thresh-hold and back waay off and it loosens the rear up (all while turning). But that helps with more money in the car than I actually paid for it 4 years ago.

    Anyhow, the osccon register,

    OSCCON = 0 110 0 1 1 1

    bit 7 = nothing, so 0 is used
    bit 6-4 = 4MHz
    bit 3 = device running from secondary clock (Internal osc)
    bit 2 = I want a stable high freq clock
    bit 1 = no idea, INTRC, made it stable I shouldn't be using this but what do I know... stable girlfirend is better than unstable so I picked stable
    bit 0 = internal osc is used because i dont want to waste space/money on ext osc.
    Last edited by erice1984; - 4th July 2007 at 01:16.

  6. #6
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    INTCON or Interrupt-on-Change IOCCON ?

    INTCON = 00 0 0 0 0 0 1

    bit 7-6 = 0 / unimplemented
    bit 5 = gpio.5
    bit 4 = gpio.4
    bit 3 = gpio.3
    bit 2 = gpio.2
    bit 1 = gpio.1
    bit 0 = gpio.0

    GPIO.0 = M_BUT so 1 = enable

  7. #7
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    So does this look right;

    [html]
    '---------- Options ------------------------------------------------------------

    define OSC 4 'Set oscillator (clk) to 4MHz
    OSCCON = %01100111 'Oscillator Settings
    ANSEL = %000000 'Analog/Digital ports
    INTCON = %00000001 'GPIO External interrupts
    GPIO = %000000 'Set High/Low GPIO.5 -> GPIO.0 (all low)
    TRISIO = %001001 'Set input/output GPIO.5 -> GPIO.0 (GP0 & 3 input)
    [/html]

    Problem it is throwin some errors on it.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 22:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 22:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th December 2008, 00:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  5. Timer PIC16F57
    By leonel in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 1st July 2005, 09:14

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