18F2431 Learning Curve


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    Oscillator speed?

    Or is that not required any more with v3.0 (I'm still on v2.60).

    Robert

  2. #2
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    I am using the internal oscillator which defaults to 8MHz
    I also tried the program with

    DEFINE OSC 8

    preceeding the LCD definition statements, all to no avail

    I was even more disappointed that my Blinky LED program didn't work

    Code:
    TRISA = 0               ' Set PORTA as output
    
    LED    VAR  PORTA.0     ' Assign name "LED" to PORTA.0
    
    mainloop:
       High LED             ' Turn on LED connected to PORTA.0
       Pause 500            ' Delay for .5 seconds
    
       Low LED              ' Turn off LED connected to PORTA.0
       Pause 500            ' Delay for .5 seconds
    
       Goto mainloop        ' Go back to loop and blink LED forever
       
       End
    I have +5V connecteds to pins 7 and 20 (AVdd and Vdd) and 0V connected to pins 8 and 19 (AVss and Vss). I have a 10k pull-up resistor from MCLR (Pin 1) to +5V and 330R in series with LED connected from RA0 (Pin 2) to 0V. I even tried fliping the LED just in case I put it in backwards!

    Any ideas on why this thing won't work as expected?
    Perhaps the default for RA0/AN0 is an analog input pin? I thought the TRISA = 0 statement would overide...

    Cheers
    Barry
    VK2XBP

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


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    How are the configs setup?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    I always stay away from analog pins until I get a basic program running.

    Robert

  5. #5
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    Thanks Robert - Unfortunatley this device has so many options per pin. If I stay away from the analog pins then I run into PWM pins, motion feedback pins and others that I haven't got my head around yet. I thought the RA0/AN0 option was the path of leas resistance.

    Dave, I am using my MeProgrammer to configure the device at time of programming.
    Details are as follows:
    Oscillator = INTRC
    Inernal External Switch Over = Enabled
    Fail-Safe Clock Monitor - Enabled
    Power-Up Timer = Disabled
    Brown-Out Reset = Enabled
    Brown-Out Reset Voltage = 2.0V
    Watchdog Timer = Enabled
    Watchdog Timer Postscaler = 1:512
    Watchdog Timer Window = Enabled
    PWM Pins = Disabled on Reset
    Low-Side Transistor Polarity = Active High
    High-Side Transistor Polarity = Active High
    Special Event Reset = Disabled
    MCLR Pin Function = Reset
    Stack Overflow/Underflow Reset = Enabled
    Low Voltage Programming = Disabled

    All other memory options are "Not Protected"

    Cheers
    Barry
    VK2XBP

  6. #6
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    172


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    Update:

    I have added the following lines to my Blinky LED program:

    Code:
    ANSEL0 = 0              ' Set all PORTA as digital I/O
    ADCON0.0 = 0            ' Disable A/D module
    TRISA = 0               ' Set PORTA as output
    I was confident I would see a blinking LED after these changes but was sadly mistaken...

    Cheers
    Barry
    VK2XBP

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


    Did you find this post helpful? Yes | No

    Default Re: 18F2431 Learning Curve

    Some will disagree, but I have never trusted the programmer to set the configs.
    What version of PBP are you running?
    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