PIC Assembler 12F683 W Register Memory Map Location

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Max Thanks!

What does that mean?

Right now I have to change the PIC on the breadboard.

12F509 is out. It has memory banking.

Probably use the 10F200.
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Some more speed bumps in this plan.

MOVLW looks right for loading a hex into W register.

W register can't be seen during a read.

So it needs to be moved one more time.

MOVWF 0x20 for example might work.

0x20? Where is that going to end up?

In a register of program memory or data memory?
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
John Thanks!

It compiled and programmed. It was a 10F200 on breadboart. That's using MPLAB X and then programming with IPE.

All I saw were values in first 5 or 6 memory locations in IPE Program Memory map at bottom of IPE page.

Did program work correctly?
 

be80be

Joined Jul 5, 2008
2,395
The code you posted will not work
You never told it where to put temp
Code:
    list      p=12F509            ; list directive to define processor
    #include <p12F509.inc>        ; processor specific variable definitions

    __CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.

;**********************************************************************
RESET_VECTOR    CODE   0x3FF      ; processor reset vector

; Internal RC calibration value is placed at location 0x3FF by Microchip
; as a movlw k, where the k is a literal value.
   
MAIN    CODE    0x000
    movwf   OSCCAL            ; update register with factory cal value


start  
    nop                       ; example code
    movlw   0xFF              ; example code
    movwf   temp              ; example code

; remaining code goes here

    END                       ; directive 'end of program'
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Bebe Thanks!

Here's the correct file.

Using 10F200 template for a 10F200 on breadboard.

movlw 0x01
movwf 0x1A

That's the new code in source file.
 

Attachments

be80be

Joined Jul 5, 2008
2,395
Here's you something to play with on the 16f505 I think you said you have one
Code:
    list      p=16F505            ; list directive to define processor

    #include <p16F505.inc>        ; processor specific variable definitions
    __CONFIG   _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC_RB4EN
; pin assignments
#define  led  PORTC,2  ; transmit pin on GP0
;***** VARIABLE DEFINITIONS
      UDATA
d1         res     1
d2         res     1
d3         res     1   
;**********************************************************************
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
RESET   CODE    0x000           ; effective reset vector
        movwf   OSCCAL          ; update OSCCAL with factory cal value
  
    goto    init              ; jump to main program
init
    movlw b'00000000'   ; set I/O
    tris    PORTC
    bsf led
    call delay
    bcf led
    call delay
    goto init
delay
   movlw    0x03
    movwf    d1
    movlw    0x18
    movwf    d2
    movlw    0x02
    movwf    d3
Delay_0
    decfsz    d1, f
    goto    $+2
    decfsz    d2, f
    goto    $+2
    decfsz    d3, f
    goto    Delay_0
            ;6 cycles
    goto    $+1
    goto    $+1
    goto    $+1
    END
 

be80be

Joined Jul 5, 2008
2,395
whats this to do the temp would make more sense
Code:
    list      p=10F200            ; list directive to define processor
    #include <p10F200.inc>        ; processor specific variable definitions

    __CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF

; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.




;***** VARIABLE DEFINITIONS
;TEMP_VAR    UDATA
;temp        RES     1             ;example variable definition






;**********************************************************************
RESET_VECTOR    CODE   0xFF       ; processor reset vector

; Internal RC calibration value is placed at location 0xFF by Microchip
; as a movlw k, where the k is a literal value.
   
MAIN    CODE    0x000
    movwf   OSCCAL            ; update register with factory cal value


start   
;       nop                       ; example code
;    movlw   0xFF              ; example code
;    movwf   temp              ; example code

; remaining code goes here
    movlw 0x01
    movwf 0x1A





    END                       ; directive 'end of program'
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Bebe Thank you

I have to stay away from 16F505 for the time being.

Okay. I was trying to leave out learning variables at the beginning here.
 

be80be

Joined Jul 5, 2008
2,395
This makes a led blink on GP2
Have lookz
Code:
   list      p=10F200            ; list directive to define processor
    #include <p10F200.inc>        ; processor specific variable definitions

    __CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF
#define  led  GPIO,2  ; transmit pin on GP0
;*******************************************************************************
; Reset Vector
;*******************************************************************************



     UDATA
d1         res     1
d2         res     1
d3         res     1 
;**********************************************************************
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
RESET   CODE    0x0000           ; effective reset vector
        movwf   OSCCAL          ; update OSCCAL with factory cal value

    goto    init              ; jump to main program
init
  
  MOVLW  ~(1<<T0CS)  ;enable GPIO2
  OPTION
  MOVLW  ~(1<<TRISIO2)  ;set GP2 as an output
  TRIS   GPIO
    
  
    bsf led
    call delay
    bcf led
    call delay
    goto init
delay
   movlw    0x03
    movwf    d1
    movlw    0x18
    movwf    d2
    movlw    0x02
    movwf    d3
Delay_0
    decfsz    d1, f
    goto    $+2
    decfsz    d2, f
    goto    $+2
    decfsz    d3, f
    goto    Delay_0
            ;6 cycles
    goto    $+1
    goto    $+1
    goto    $+1
    END
 

be80be

Joined Jul 5, 2008
2,395
Here I was playing with the 10f200 this bit bangs serial out gp2
Code:
      list      p=10F200            ; list directive to define processor
    #include <p10F200.inc>        ; processor specific variable definitions
    __CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF
; '__CONFIG' directive is used to embed configuration word within .asm file.;***** VARIABLE DEFINITIONS
     #define  TX  GPIO,2  ; transmit pin on GP0
;***** VARIABLE DEFINITIONS
      UDATA
    buffer     res    1          
    counter    res    1
    Count      res    1
  
;**********************************************************************
RESET   CODE    0x000           ; effective reset vector
        movwf   OSCCAL          ; update OSCCAL with factory cal value
  
    goto    init              ; jump to main program
init
  MOVLW  ~(1<<T0CS)  ;enable GPIO2 and 1:256 Timer0 prescaler
  OPTION
  MOVLW  ~(1<<TRISIO2)  ;set GP2 as an output
  TRIS   GPIO
bsf  TX
movlw 'H'               ; sets text to loads buffer with
call start
movlw 'I'
call start
movlw ' '
call start
movlw 'B'
call start
movlw 'o'
    call start
movlw 'b'
    call start
movlw ' '
call start
movlw 'w'
call start
movlw 'a'
call start
movlw 's'
call start
movlw ' '
call start
movlw 'h'
call start
movlw 'e'
call start
movlw 'r'
call start
movlw 'e'
call start
movlw 0x0A
call start
movlw 0x0D
call start
    goto init   ;loop for ever
start
movwf buffer
movlw 0x08
movwf counter        ; counts the 8 bits
    bcf   TX             ; set TX low
    call  BItdelay       ; delay to get a 9600 bit rate
TXLoop
    rrf   buffer ,f      ;send one bit
    btfss STATUS ,C      ;
    bcf   TX             ;
    btfsc STATUS ,C  ;
    bsf   TX  ;
    call  BItdelay  ;
    decfsz counter,f     ;test if all done
    goto  TXLoop  ;
    bsf   TX  ;
    call  BItdelay  ;
    return
BItdelay                 ; timing delay

    movlw 0x17
    movwf  Count
Wait  
    nop
    decfsz Count ,f
    goto   Wait
    return

END  ; direective 'end of program'
 

Thread Starter

PICNewbee

Joined Mar 31, 2017
355
Bebe Thank you!

Where are you getting that readout at the bottom with those tabs? MPLAB X?

The real deal is let me start another post and get back on track with the tutorial.

He will get to variables in the next lesson or two.
 
Top