Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Anybody used a PIC16F1934?

Status
Not open for further replies.
I just bought a couple and they are a bit different to what I'm used to.

If anyone has written any code for one in assembly and is willing to share it with me I would be very appreciative.
Doesn't matter what the code does, just want to see it.
 
It's just an enhanced 14 bit core, essentially the same instruction set as previous ones, plus a few extras :D

I suppose it's half way between the standard 14 bit core and the 18F series?.

There's a migration document at MicroChip, which presumably tells you all you need to know - one of the first lines mentions it's optimised for C.

https://www.electro-tech-online.com/custompdfs/2010/04/41375A.pdf
 
Arr I haven't a clue about C.

Yeah I eventually get something to work, but simple things like seeing the dual config word setup and things like that. Its just easier to see someones working program sometimes.

I'll look at the migration document.

Thanks nigel.
 
Have not used any of the enhanced mid-range devices yet. GCBasic has started support, as I'm sure all the other compilers out there have too. So here is the compiled assembly for an led blinky, hope it helps. The assembly could be built in MPLAB, with no errors, which is all I can say since I don't have the device.

Code:
;Program compiled by Great Cow BASIC (0.9 29/11/2009)
;Need help? See the GCBASIC forums at http://sourceforge.net/forum/?group_id=169286,
;check the documentation or email w_cholmondeley@users.sourceforge.net.

;********************************************************************************

;Set up the assembler options (Chip type, clock source, other bits and pieces)
 LIST p=16F1934, r=DEC
#include <P16F1934.inc>
 __CONFIG _CONFIG1, _MCLRE_OFF & _WDTE_OFF & _FOSC_INTOSC
 __CONFIG _CONFIG2, _LVP_OFF & _PLLEN_OFF

;********************************************************************************

;Set aside memory locations for variables
DELAYTEMP	EQU	112
DELAYTEMP2	EQU	113
SysWaitTempMS	EQU	114
SysWaitTempMS_H	EQU	115
SysWaitTempS	EQU	116

;********************************************************************************

;Vectors
	ORG	0
	goto	BASPROGRAMSTART
	ORG	4
	retfie

;********************************************************************************

;Start of program memory page 0
	ORG	5
BASPROGRAMSTART
;Call initialisation routines
	call	INITSYS

;Start of the main program
	banksel	TRISB
	bcf	TRISB,0
START
	banksel	PORTB
	bsf	PORTB,0
	movlw	1
	movwf	SysWaitTempS
	call	Delay_S
	bcf	PORTB,0
	movlw	1
	movwf	SysWaitTempS
	call	Delay_S
	goto	START
BASPROGRAMEND
	sleep
	goto	$

;********************************************************************************

Delay_MS
	incf	SysWaitTempMS_H, F
DMS_START
	movlw	4
	movwf	DELAYTEMP2
DMS_OUTER
	movlw	165
	movwf	DELAYTEMP
DMS_INNER
	decfsz	DELAYTEMP, F
	goto	DMS_INNER
	decfsz	DELAYTEMP2, F
	goto	DMS_OUTER
	decfsz	SysWaitTempMS, F
	goto	DMS_START
	decfsz	SysWaitTempMS_H, F
	goto	DMS_START
	return

;********************************************************************************

Delay_S
DS_START
	movlw	232
	movwf	SysWaitTempMS
	movlw	3
	movwf	SysWaitTempMS_H
	call	Delay_MS
	decfsz	SysWaitTempS, F
	goto	DS_START
	return

;********************************************************************************

INITSYS
	movlw	135
	banksel	OSCCON
	andwf	OSCCON,F
	movlw	112
	iorwf	OSCCON,F
	bcf	ADCON0,ADON
	bcf	ADCON1,ADFM
	banksel	ANSELA
	clrf	ANSELA
	clrf	ANSELB
	banksel	CM2CON0
	bcf	CM2CON0,C2ON
	bcf	CM1CON0,C1ON
	banksel	PORTA
	clrf	PORTA
	clrf	PORTB
	clrf	PORTC
	clrf	PORTD
	clrf	PORTE
	return

;********************************************************************************

;Start of program memory page 1
	ORG	2048

 END
 
Hi Jake,

The 16F88 had dual config words so it's not an entirely new concept;

Code:
    #include    <p16f88.inc>
    errorlevel    -302

    __CONFIG  _CONFIG1, _CCP1_RB0&_LVP_OFF&_MCLR_OFF&_PWRTE_ON&_WDT_OFF&_INTRC_IO
    __CONFIG  _CONFIG2, _IESO_OFF & _FCMEN_OFF
;
Anyway, I just received 16F1936 samples so I'll try to help you out after I upgrade my MPLAB, if you haven't figured it out already.

Kind regards, Mike
 
Last edited:
Just noticed in the MPLAB v8.5 "supported devices" list that the PICKit 2 doesn't support any of the 16F18xx or 16F19xx "enhanced" devices.

Anyone know if they will add support for PICKit 2 for these new devices?
 
Hi Jake,

Just wanted to mention that there are "template" files for the 16F18xx and 16F19xx devices in the MPLAB v8.50 I just installed. Using the 16F1936TEMP.ASM file as a guide, here's what my template looks like;

Take care. Mike

Code:
[B];******************************************************************
;*                                                                *
;*  Filename: 16F1936 Boot 2.asm                                  *
;*    Author: Mike McLaren, K8LH   (k8lh_at_arrl.net)             *
;*      Date: 21-Apr-10                                           *
;*                                                                *
;*  K8LH 16F1936 Serial Boot Loader                               *
;*                                                                *
;*                                                                *
;*     MPLab: 8.50    (tabs=8)                                    *
;*     MPAsm: 5.35                                                *
;*                                                                *
;******************************************************************

        #include <P16F1936.INC>
        radix  dec

  __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _IESO_OFF & _FCMEN_OFF
  __CONFIG _CONFIG2, _BORV_25 & _LVP_OFF
;
; _PWRTE_OFF    default
; _CP_OFF       default
; _CPD_OFF      default
; _BOREN_ON     default
; _CLKOUTEN_OFF default
;
; _WRT_OFF      default
; _PLLEN_ON     default
; _STVREN_ON    default
; _VCAPEN_OFF   default

;--< variables >---------------------------------------------------

;--< constants >---------------------------------------------------

;******************************************************************
;  reset vector                                                   *
;******************************************************************
        org     0x000
v_reset
        clrf    STATUS          ;                                 |
        goto    init            ;                                 |

;******************************************************************
;  interrupt vector                                               *
;******************************************************************
        org     0x004
v_interrupt
        retfie                  ;                                 |

;******************************************************************
;  main.init                                                      *
;******************************************************************
init
        goto    $               ;                                 |

;******************************************************************
;  main.loop                                                      *
;******************************************************************
loop
        goto    $               ;                                 |
;******************************************************************
;  subroutines                                                    *
;******************************************************************

;******************************************************************
        end    [/B]
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top