Q 16F690 and need of x-tal

Ian Rogers

Joined Dec 12, 2012
1,136
The other thing.. Toggling a bit..... RC7 = ~(RC7); ( bitwise not! )

All others are byte wise and only work if indexed or are 0.. RC7 ^= (1<< 7);
or RC0 = !RC0;

I don't know why the parenthesis are needed, but it doesn't work unless you use it!
It must be a compiler thing as using the Arduino IDE it does work without parenthesis!!!
 

bertus

Joined Apr 5, 2008
23,023
Hello,

This is the ASM blink code I got with the pickit 2 tutorials:

Code:
;******************************************************************************
;Software License Agreement   
;   
;The software supplied herewith by Microchip Technology   
;Incorporated (the "Company") is intended and supplied to you, the  
;Company’s customer, for use solely and exclusively on Microchip   
;products. The software is owned by the Company and/or its supplier,
;and is protected under applicable copyright laws. All rights are   
;reserved. Any use in violation of the foregoing restrictions may   
;subject the user to criminal sanctions under applicable laws, as   
;well as to civil liability for the breach of the terms and   
;conditions of this license.   
;   
;THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,  
;WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED  
;TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A   
;PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,  
;IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR   
;CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.   
; *******************************************************************
; PICkit 2 Lesson 2 - "Blink"
;
; First lesson showed how to make an LED turn on,
; Now we'll look at how to make it blink.  Delay loops are necessary
; to slow down the on and off commands so they are visible to humans.
; *******************************************************************
; * See Low Pin Count Demo Board User's Guide for Lesson Information*
; *******************************************************************
; * NOTE: The PIC16F690 requires the AC162061 header for debugging  *
; *******************************************************************

#include <p16F690.inc>
  __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

  cblock 0x20
Delay1  ; Define two file registers for the
Delay2  ; delay loop
  endc
   
  org 0
Start:
  bsf  STATUS,RP0  ; select Register Page 1
  bcf  TRISC,0  ; make IO Pin B.0 an output
  bcf  STATUS,RP0  ; back to Register Page 0
MainLoop:
  bsf  PORTC,0  ; turn on LED C0
OndelayLoop:
  decfsz  Delay1,f  ; Waste time.  
  goto  OndelayLoop  ; The Inner loop takes 3 instructions per loop * 256 loopss = 768 instructions
  decfsz  Delay2,f  ; The outer loop takes and additional 3 instructions per lap * 256 loops
  goto  OndelayLoop  ; (768+3) * 256 = 197376 instructions / 1M instructions per second = 0.197 sec.
  ; call it a two-tenths of a second.
   
  bcf  PORTC,0  ; Turn off LED C0
OffDelayLoop:
  decfsz  Delay1,f  ; same delay as above
  goto  OffDelayLoop
  decfsz  Delay2,f
  goto  OffDelayLoop
  goto  MainLoop  ; Do it again...
  end
The bcf command clears a bit and the bsf command sets a bit.

Bertus
 

Thread Starter

FroceMaster

Joined Jan 28, 2012
708
Now this part works,
LCD Working, thanx to ANSELH=0;
LED Blinking steady again with RC7=!RC7;

Works to continue on rest of program, will properly return again :)
 
Top