Continue to Site

# Large Code starts to glitch on 16F628A

Status
Not open for further replies.

#### Smartie

##### Member
Hey,

Im currently working on a PS/2 interface for my microchip, my lcd code has been working perfectly fine but as i added more code to the PS/2 interface, I've noticed that any hex number that is outputted to the LCD was displaying letters in a funny order that were not HEX.

so i got a pen and paper and wrote down the letters to see if i could find any pattern in them, when i finished writing them i realized it was part of a string i defined in a table at the very begging of the code (just after ORG 0x05). the Hex table is defined some where around ORG 0x10B

would you guys know whats causing my program to call a address at the start of my code rather than where its suppose to be?

If you want more details such as source code, feel free to ask

Cheers
Roman

#### Smartie

##### Member
ok just an update, i was following it with the MPLAB Sim debugger, and the moment it calls
Code:
addwf PCL,F
it jumps the the start of the program. is there a work around for this?

#### Pommie

##### Well-Known Member
You need to set PCLATH to the high word of the table. So, in your case you would load PCLATH with 0x01.

Mike.

#### Smartie

##### Member
You need to set PCLATH to the high word of the table. So, in your case you would load PCLATH with 0x01.

Mike.

Thanks, i was just searching google up on that and found that i should include this at the start of my table and now i don't have a problem any more
Code:
HEX_Table
movwf	tmp2
movlw	high(HEX_TABLE_START)
movwf	PCLATH
movfw	tmp2
skpnc
incf	PCLATH,f
movwf	PCL
HEX_TABLE_START
RETLW   0x30
RETLW   0x31
RETLW   0x32
RETLW   0x33
RETLW   0x34
RETLW   0x35
RETLW   0x36
RETLW   0x37
RETLW   0x38
RETLW   0x39
RETLW   0x41
RETLW   0x42
RETLW   0x43
RETLW   0x44
RETLW   0x45
RETLW   0x46
;PCLATH code was from http://www.piclist.com/techref/microchip/tables.htm

Cheers
Roman

Last edited:

#### Mr RB

##### Well-Known Member
Is your name Roman too? That's gonna get confusing...

#### birdman0_o

##### Active Member
Is your name Roman too? That's gonna get confusing...

Just be happy your name isnt Mike!

#### Nigel Goodwin

##### Super Moderator
Just be happy your name isnt Mike!

Perhaps Mike's his middle name?

At one time we had six adult Ju Jitsu students, all called Paul - now that was confusing - we still have two left, both instructors now.

#### Smartie

##### Member
Is your name Roman too? That's gonna get confusing...

There's another member on this site named Roman?

Originally Posted by birdman0_o View Post
Just be happy your name isnt Mike!
Perhaps Mike's his middle name?

At one time we had six adult Ju Jitsu students, all called Paul - now that was confusing - we still have two left, both instructors now.

No, my name is Roman P. Vaughan, I'm currently starting up my own site and you can find more details about me there:
**broken link removed** (Yeah i know, Its being hosted in a sub folder on my brothers site a.t.m.)

#### birdman0_o

##### Active Member
Mr. RB is Roman as well.

#### atferrari

##### Well-Known Member
Redundancy?

In my family, in four generations, there are more than 40 ladies with double names, all starting with María. No surprise that everybody use the second one, always.

The possibility of a confussion was evident the day a lady from a medical X ray service, asked on the phone for "María Ferrari". After telling her that we had a list of not less than 10 to choose from, she promised to revert with more data.

In 24 hours she finally contacted one of my daughters.

Status
Not open for further replies.

Replies
10
Views
1K
Replies
90
Views
5K
Replies
2
Views
1K
Replies
8
Views
1K
Replies
18
Views
4K