Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 5th June 2008, 08:01 AM   (permalink)
Arrow How to Create a Table?

This is pretty hard but need to find a way to do.

I have 100 eeprom saved data.I need to create a table from this values.

I can read the eeprom values & load into GP registers.But my main program working with these registers.So I cannot use these registers.

So I need a way to create a table using these EEPROM values.
Suraj143 is offline   Reply With Quote
Old 5th June 2008, 08:19 AM   (permalink)
Default

Quote:
Originally Posted by Suraj143 View Post
This is pretty hard but need to find a way to do.

I have 100 eeprom saved data.I need to create a table from this values.

I can read the eeprom values & load into GP registers.But my main program working with these registers.So I cannot use these registers.

So I need a way to create a table using these EEPROM values.
Check the datasheets and application notes, it's a VERY common requirement - or check my tutorials, many of which use tables themselves.

The required command for the table is RETLW, with a calculated jump using PCL. 100 entries is easy, but you must ensure it doesn't cross a 256 word boundary, or you have to take special precautions (again, my tutorials, LED matrix, gives examples of large tables).
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 5th June 2008, 08:23 AM   (permalink)
Default

Hi Nigel thanks for the info.You didn't get my problem.

I need to create a table using my EEPROM saved values.

From these saved data I need to create a table.
Suraj143 is offline   Reply With Quote
Old 5th June 2008, 08:49 AM   (permalink)
Default

Quote:
Originally Posted by Suraj143 View Post
Hi Nigel thanks for the info.You didn't get my problem.

I need to create a table using my EEPROM saved values.

From these saved data I need to create a table.
Hi Suraj,
Whats the PIc type.?
If the values exist in EEPROM, why do you need to create a Table in the registers.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 5th June 2008, 08:54 AM   (permalink)
Default

Quote:
Originally Posted by ericgibbs View Post
Hi Suraj,
Whats the PIc type.?
If the values exist in EEPROM, why do you need to create a Table in the registers.
You are 100% correct.The values are stored in EEPROM.I' using PIC16f628A.
Suraj143 is offline   Reply With Quote
Old 5th June 2008, 08:56 AM   (permalink)
Default

Quote:
Originally Posted by Suraj143 View Post
You are 100% correct.The values are stored in EEPROM.I' using PIC16f628A.
hi,
Whats the purpose of the Table, why cant you use the values in the EEP.?

Why do you have to Tabulate them.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 5th June 2008, 08:58 AM   (permalink)
Default

You need to explain what you are trying to do. Your EEPROM data is already a table, moving it to SFRs or Rom will make no difference. What do you want to do with the values in EEPROM?

Mike.
Pommie is online now   Reply With Quote
Old 5th June 2008, 09:01 AM   (permalink)
Default

Hi in my main menu theres such a thing like this.

Code:
Shift	movf	data1,W
	movwf	data2
	movf	data2,W
	movwf	data3
	---
	---
The data registers contains saved data.If I recall EEPROM values & save in this data registers due to shift in the main program the data will get lost.

So again I have to read the EEPROM 100 saved places.

That is why I need to create a table.
Suraj143 is offline   Reply With Quote
Old 5th June 2008, 09:05 AM   (permalink)
Default

Why can't you move the values from the EEPROM into the data variables?

Mike.
Pommie is online now   Reply With Quote
Old 5th June 2008, 09:10 AM   (permalink)
Default

Quote:
Originally Posted by Pommie View Post
Why can't you move the values from the EEPROM into the data variables?

Mike.
You mean to move them into other banks GP registers?
Suraj143 is offline   Reply With Quote
Old 5th June 2008, 09:17 AM   (permalink)
Default

hi Mike,
I will just observe, dont want to confuse Suraj with multiple replies.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 5th June 2008, 09:36 AM   (permalink)
Default

Quote:
Originally Posted by Suraj143 View Post
You mean to move them into other banks GP registers?
Yes, although there isn't 100 consecutive location in a 628, you could use locations 0x5c-0x6f (20 bytes) in bank 0 and the 80 bytes in bank 1.

Do you understand how the FSR register works?

With the FSR register you can move the EEPROM values into the SFRs by doing,
Code:
data1		equ	0x5c
data21		equ	0xa0

MoveData
		movlw	data1		;point indirect register
		movwf	FSR		; at data 1
		bcf	STATUS,IRP	;ensure we write to bank 0 and 1
		bsf	STATUS,RP0	;bank 1
		clrf	EEADR		;start at location zero
MoveLoop	bsf	STATUS,RP0	;Bank 1
		bsf	EECON1,RD	;EE Read
		movf	EEDATA,W	;W = EEDATA
		incf	EEADR,F		;point to next location
		bcf	STATUS,RP0	;Bank 0
		movwf	INDF		;write to SFRs
		incf	FSR,F		;move to next location
		movfw	FSR
		xorlw	data1+d'20'	;end of bank 0 data?
		btfss	STATUS,Z	
		goto	NextCheck
		movlw	data21		;yes, so point FSR at next bank
		movwf	FSR
NextCheck	movfw	FSR		
		xorlw	data21+d'80'	;end of all data
		btfss	STATUS,Z
		goto	MoveLoop	;no carry on
		return			;done.
You can use a similar method to access the same area later. I assume you are doing some sort of scrolling display.

The above is untested code and may not work. I state this as I will not be able to correct it if it turns out to be flawed due to the 15 minute edit time.

Mike.
Pommie is online now   Reply With Quote
Old 5th June 2008, 09:39 AM   (permalink)
Default

Quote:
Originally Posted by ericgibbs View Post
hi Mike,
I will just observe, dont want to confuse Suraj with multiple replies.
Hi Eric,

Sorry for butting in.

Mike.
Pommie is online now   Reply With Quote
Old 5th June 2008, 09:49 AM   (permalink)
Default

Quote:
Originally Posted by Pommie View Post
Hi Eric,

Sorry for butting in.

Mike.

Thats not a problem.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is online now   Reply With Quote
Old 5th June 2008, 09:59 AM   (permalink)
Default

Hi Mike Excellent code.That is what I was expecting.

I was looking a method how to place saved data in a one place.The above code of you allow to do that.So no need to create a table.

Thanks for the support.
Suraj143 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Create a children's table? jpanhalt Feedback/Comments 6 11th December 2007 10:45 PM
Want to create two signals..... aidantmurphy General Electronics Chat 1 15th February 2005 05:26 PM
This is how to create schematics williB General Electronics Chat 10 13th December 2004 12:30 AM
truth table vs lookup table alamy Micro Controllers 14 16th June 2004 07:48 PM
Simple Table Read and Table Write for PIC18F452 daveboy Micro Controllers 1 17th July 2003 08:43 PM



All times are GMT. The time now is 02:37 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.