12f609


Closed Thread
Results 1 to 6 of 6

Thread: 12f609

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Question HELP! Debugin does not work

    I am seeing strange behavior with the 12F609. I have a start up port toggle to let me know it is going through the code. When it gets to the debugin I can't seem to make the ports work.



    INCLUDE "Modedefs.Bas"
    @ DEVICE PIC12F609, MCLR_OFF, IOSCFS_8MHZ, INTRC_OSC_NOCLKOUT,protect_off



    GPIO = 0
    TRISIO = %001100

    'TRISIO.0 ' Output
    'TRISIO.1 ' Output
    'TRISIO.2 ' Input IR module input
    'TRISIO.3 ' Input turn off MCLR
    'TRISIO.4 ' Output
    'TRISIO.5 ' Output



    DEFINE DEBUGIN_REG GPIO ' Set as software RX in
    DEFINE DEBUG_BAUD 1200 ' Set bit rate
    DEFINE DEBUGIN_BIT 2 ' Set GPIO bit 2
    DEFINE DEBUGIN_MODE 1 ' Set Debugin mode: 0 = true, 1 = inverted


    ; VARIABLES
    Payload VAR byte
    pause 100 ' pause holds up startup initialization for programming


    pause 1000
    GPIO = %010001

    pause 1000
    GPIO = %000000

    pause 1000
    GPIO = %010001

    pause 1000
    GPIO = %000000



    main:

    debugin [wait (255), payload]
    select case Payload
    case 0 'All stop
    GPIO = %000000

    CASE 10 'Right spin
    GPIO = %100000

    CASE 50 'Left spin
    GPIO = %000001

    case 100 'Straight
    GPIO = %010001

    END SELECT
    goto main

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Analog pins ...
    Code:
    ANSEL = 0
    DT

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Insert DEFINE OSC 8 when using IOSCFS_8MHZ
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4


    Did you find this post helpful? Yes | No

    Wink nailed it

    Bruce nailed it. The ANSEL is superceded by the TRISIO according to the datasheet on all outputs, except for inputs where ANSEL is needed. I guess PBP was having timing issues since the define osc 8 was not declared.

    Shouldn't that result in an error though? I can't see where you would want to let the compiler have opposing declarations.

    Thanks guys!!!!

    Nick

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