Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to implement "TBLRD" instruction

Status
Not open for further replies.

BR-99

Newbie level 4
Newbie level 4
Joined
Aug 4, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
48
Hi

I'm trying to read PIC18F Program Memory (table read) via USB

Is there a way (setting bits in registers) to implement "TBLRD" instruction ?

I set the 3 TBLPTR registers, and read TABLAT but can't transfer MEM(TBLPTR) to TABLAT

Any comment is appreciated

Thanks
 

hi
the instruction table read is used to read a table from pic flash rom, for USB i don't know really.
here's an exemple to read a string of characters from pic flash rom and send it to an LCD

Code:
MOVWF TBLPTRL ; LOOK UP TABLE LOW BYTE ADRESS
	MOVLW 0X02 
	MOVWF TBLPTRH  ; LOOK UP TABLE HIGH BYTE ADRESS
B7      TBLRD* ;TABLAT POINT TOWARD THE FIRST STRING 
	MOVF TABLAT,W ; COPY CHAR TO W
	BZ EXIT
	CALL dataw
	INCF TBLPTRL,F
	BRA B7
EXIT GOTO EXIT

ORG 0X200
MYDATA  DB "Greetings from Montreal CANADA " ,0
END
 
Thanks

My PIC has firmware, so i'm not sure where and how i can load (which org address) extra program (as your example) that is why I want to do it via the USB (included in the firmware)

Thanks













hi
the instruction table read is used to read a table from pic flash rom, for USB i don't know really.
here's an exemple to read a string of characters from pic flash rom and send it to an LCD

Code:
MOVWF TBLPTRL ; LOOK UP TABLE LOW BYTE ADRESS
	MOVLW 0X02 
	MOVWF TBLPTRH  ; LOOK UP TABLE HIGH BYTE ADRESS
B7      TBLRD* ;TABLAT POINT TOWARD THE FIRST STRING 
	MOVF TABLAT,W ; COPY CHAR TO W
	BZ EXIT
	CALL dataw
	INCF TBLPTRL,F
	BRA B7
EXIT GOTO EXIT

ORG 0X200
MYDATA  DB "Greetings from Montreal CANADA " ,0
END
 

It's not clear what you are actually attempting.

If your development board has a USB Bootloader, which it seems to from your description, then the application code must be written is a manner to always it to be relocated to correct position in Flash memory.

Otherwise, the application code could attempt to over write the bootloader.

What programming language are you using to write your application code, C or Assembly?

If C language, which compiler set are you utilizing?

Also, can you provide a link to your actual development board or upload the board's user manual?


BigDog
 

The USB kit https://electronics-diy.com/USB_IO_Board.php has MR & MW commands which , to my understanding, allows access to Data Memory
I want to add interrupt routine to support PORTB[7:4] on-change interrupt
To do so I need to read (and convert object to assem) the firmware.
I can use C# code to set TBLPTR (3 registers) 21 bits address of the Memory (MW commands via USB)
I can read TABLAT , however I don't see a way to move Byte from Mem(TBLPTR) to TABLAT using MW command
Is there a way to do so by setting some registre's bits ???



It's not clear what you are actually attempting.

If your development board has a USB Bootloader, which it seems to from your description, then the application code must be written is a manner to always it to be relocated to correct position in Flash memory.

Otherwise, the application code could attempt to over write the bootloader.

What programming language are you using to write your application code, C or Assembly?

If C language, which compiler set are you utilizing?

Also, can you provide a link to your actual development board or upload the board's user manual?


BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top