PDA

View Full Version : PIC 18F452 Table Pointer/ Table Read



sougata
- 13th March 2006, 06:17
Hi everybody,

I recently did a 5x8 LED dot matrix project . Used PBP and asm. ASM for the interrupt based display refresh. It was 80 Colums (16 characters) x 8 rows. Rows scan type. For conversion from ASCII I used the PBP lookup. It seems from the PIC18F452 instruction set that using a tablepointer based table read may reduce the code overhead and increase speed. My intution says that PBP is not using this stuff to keep the whole thing compatible with the 16F series.(The PCL of PIC18 increments by 2 and RETLW thus not compatible with other series) I tried reading the 18C reference manual but the concept is not so clear.

So I am looking forward to

1. Any example/tutorial/reference on using the above table instruction

2. Insight on using it within PBP

3. Creating a Lookup table

BTW if anyone has done a 5x8 Font table please help (I was lazy and used a 5x7 one, still reluctant to update it)

Dave
- 13th March 2006, 11:56
sougata, Here is a snipit of code I used with some HP-HCMS-29XX displays for a battery charger I designed. I retrieved them from old Motorola cell phones. It decodes the ascii value of the character and places the 5 collums of data into the appropriate arrays. The values in the table are the leds from bottom=msb to top=lsb. HTH

' ************************************************** ******************
CHARTABL: 'CHARACTER LOOK-UP TABLE FOR COLLUMS
' ************************************************** ******************
IF CHARACTER > 31 THEN
' " ","!",""","#","$","%","&","'","(",")","*","+",",",
'"-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?",
'"@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R",
'"S","T","U","V","W","X","Y","Z","[","\","]","^","_","`","a","b","c","d","e",
'"f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x",
'"y","z","{","|","}","~"]
COL1:
LOOKUP CHARACTER - 32,[$00,$00,$00,$14,$24,$23,$36,$00,$1C,$00,$14,$08,$0 0,_
$08,$00,$20,$3E,$00,$42,$21,$18,$27,$3C,$01,$36,$0 6,$00,$00,$08,$14,$00,$02,_
$32,$7E,$7F,$3E,$7F,$7F,$7F,$3E,$7F,$00,$20,$7F,$7 F,$7F,$7F,$3E,$7F,$3E,$7F,_
$46,$01,$3F,$1F,$3F,$63,$07,$61,$7F,$02,$00,$04,$4 0,$00,$20,$7f,$38,$38,$38,_
$08,$0c,$7f,$00,$00,$7f,$00,$7c,$7c,$38,$7c,$08,$7 c,$48,$04,$3c,$1c,$3c,$44,_
$0c,$44,$08,$00,$00,$00],COLLUM(0)
COL2:
LOOKUP CHARACTER - 32,[$00,$00,$07,$7F,$2A,$13,$49,$05,$22,$00,$08,$08,$5 0,_
$08,$60,$10,$51,$42,$61,$41,$14,$45,$4A,$71,$49,$4 9,$36,$56,$14,$14,$41,$01,_
$49,$11,$49,$41,$41,$49,$09,$41,$08,$41,$40,$08,$4 0,$02,$04,$41,$09,$41,$09,_
$49,$01,$40,$20,$40,$14,$08,$51,$41,$04,$00,$02,$4 0,$01,$54,$48,$44,$44,$54,_
$7E,$52,$08,$44,$20,$10,$41,$04,$08,$44,$14,$14,$0 8,$54,$3F,$40,$20,$40,$28,_
$50,$64,$36,$00,$00,$08],COLLUM(1)
COL3:
LOOKUP CHARACTER - 32,[$00,$4F,$00,$14,$7F,$08,$55,$03,$41,$41,$3E,$3E,$3 0,_
$08,$60,$08,$49,$7F,$51,$45,$12,$45,$49,$09,$49,$4 9,$36,$36,$22,$14,$22,$51,_
$79,$11,$49,$41,$41,$49,$09,$49,$08,$7F,$41,$14,$4 0,$0C,$08,$41,$09,$51,$19,_
$49,$7F,$40,$40,$38,$08,$70,$49,$41,$08,$41,$01,$4 0,$02,$54,$44,$44,$44,$54,_
$09,$52,$04,$7D,$40,$28,$7F,$18,$04,$44,$14,$14,$0 4,$54,$44,$40,$40,$30,$10,_
$50,$54,$41,$7F,$41,$04],COLLUM(2)
COL4:
LOOKUP CHARACTER - 32,[$00,$00,$07,$7F,$2A,$64,$22,$00,$00,$22,$08,$08,$0 0,_
$08,$00,$04,$45,$40,$49,$4B,$7F,$45,$49,$05,$49,$4 9,$00,$00,$41,$14,$14,$09,_
$41,$11,$49,$41,$22,$49,$09,$49,$08,$41,$3F,$22,$4 0,$02,$10,$41,$09,$21,$29,_
$49,$01,$40,$20,$40,$14,$08,$45,$00,$10,$41,$02,$4 0,$04,$54,$44,$44,$48,$54,_
$01,$52,$04,$40,$44,$44,$40,$04,$04,$44,$14,$18,$0 4,$54,$40,$20,$20,$40,$28,_
$50,$4C,$00,$00,$36,$08],COLLUM(3)
COL5:
LOOKUP CHARACTER - 32,[$00,$00,$00,$14,$12,$62,$50,$00,$00,$1C,$14,$08,$0 0,_
$08,$00,$02,$3E,$00,$46,$31,$10,$39,$30,$03,$36,$3 E,$00,$00,$00,$14,$08,$06,_
$3E,$7E,$36,$22,$1C,$41,$01,$7A,$7F,$00,$01,$41,$4 0,$7F,$7F,$3E,$06,$5E,$46,_
$31,$01,$3F,$1F,$3F,$63,$07,$43,$00,$20,$7F,$04,$4 0,$00,$78,$38,$20,$7F,$18,_
$02,$3E,$78,$00,$3D,$00,$00,$78,$78,$38,$08,$7C,$0 8,$20,$20,$7C,$1C,$3C,$44,_
$3C,$44,$00,$00,$08,$04],COLLUM(4)
ENDIF
RETURN

Dave Purola,
N8NTA

sougata
- 13th March 2006, 13:13
Hi,

Thanks dave for the Lookup table. Any thoughts on the table read issue ?

mister_e
- 13th March 2006, 14:11
do a search within a thread called 'embedded string in your codespace' or something like that. If my memory is good, there's some example in there.

MPASM book explain it a little bit too. Maybe there's some appnote on the Microchip's website.

sougata
- 13th March 2006, 15:12
Hi,

Darrel used the READCODE in his example of embedding strings. The article is located here http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10 .

Bruce used the table pointer in his example for the PIC18F452 http://www.picbasic.co.uk/forum/showthread.php?t=1999 located here. By the way Steve your memory is great only you need to brushup your pointer skills ;)

mister_e
- 13th March 2006, 21:10
LMAO! but... did you read the name of the thread where you take the Bruce example..

Hum hum!

sougata
- 14th March 2006, 03:01
Hey Steve,

Sorry pal to comment on your pointer skills, I am pushing myself harder and harder to get a few pending jobs done within this MARCH. Need a RESET followed by a Sleep with the watchdog and interrupt (wife) disabled.:D

mister_e
- 14th March 2006, 03:07
Yeah i know what you mean... don't worry.

I've myself some USART problem between my head and the rest of the body.. arms and legs :)

Beer didn't help... just worst. I really need a human ICD NOW!!!