View Full Version : 12f609
Macgman2000
- 17th October 2009, 01:35
Does anyone have a picbasic template for 12F609?
I want to use the device with MCLR as input, not as MCLR. Also 8Mhz internal oscillator and set all remaining ports to outputs. I have tried a bunch of things and none worked. I am using the latest and greatest compiler. So I scrapped it all and want to see if anyone has used this chip body?
Any help is very much appreciated.
Nick
Darrel Taylor
- 17th October 2009, 02:28
If you meant a template for the configs ...
There is a "template" for every chip, located in the PBP folder.
For a 12F609, open the 12F609.inc file and you should see this ...
If you are using the default PM assembler, they are the blue ones.
If using MPASM, they are the green ones.
;************************************************* ***************
;* 12F609.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2007 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 04/30/07 *
;* Version : 2.50 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
include 'M12F609.INC' ; PM header
device pic12F609, intrc_osc_noclkout, wdt_on, mclr_on, ioscfs_4mhz, protect_off
XALL
NOLIST
else
LIST
LIST p = 12F609, r = dec, w = -302
INCLUDE "P12F609.INC" ; MPASM Header
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _IOSCFS_4MHZ & _CP_OFF
NOLIST
endif
LIST
For more info, see this thread ...
Presetting Configuration Fuses (PIC Defines) into your Program
http://www.picbasic.co.uk/forum/showthread.php?t=543
<br>
Macgman2000
- 17th October 2009, 23:09
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
Darrel Taylor
- 17th October 2009, 23:28
Analog pins ...
ANSEL = 0
Bruce
- 18th October 2009, 15:09
Insert DEFINE OSC 8 when using IOSCFS_8MHZ
Macgman2000
- 18th October 2009, 18:24
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
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.