Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F886 does not transfer data from EEPROM to PORTB

Status
Not open for further replies.

foglie0p

New Member
Hi all,

New on here, very interesting forum full of good things by the way.

I have been programming PICs for a little while now, on and off.

I was just putting together a few lines to display messages on a LCD in ASM using the EEPROM but I came across a strange thing I cant understand.

I move the data from the EEPROM to PORTB but nothing gets there... I tried moving the data to a buffer and then to PORTB. It goes fine from the EEPROM to the buffer but the nothing through to PORTB...

If you look at the piece of code attached it is under the "readeeprom" subroutine that you will find this part.

Cheers to all and hopefully someone can shed my light on this one...
 
Last edited:
There is so much of that code that I don't understand because you haven't described the hardware. However, what I do understand is that the routines line1 and line2 are unlikely to be in page 0 and so will likely crash the processor. You are also not clearing ANSEL or ANSELH and so most of portb will read back as zero.

Also, why are you redefining the hardware register when they are defined in the include file.

Mike.
 
Make sure that you have set the port pins as digital (ANSEL, ANSELH), also as an aside, I don't see an ORG directive anywhere, so if you later add an interrupt service routine, any tables you have will move possibly pushing you beyond page boundaries etc.
 
Last edited:
I know it is very messy piece of code, I just threw that together to see if I could navigate through different menus and submenus with a scroll button to switch menus and an enter button to get inside sub menus.

So the code itself above is not even finished, I am just testing it as I go. It is probably why it is impossible to understand and as well I am fo sure not the best at all in structuring my code...yet.

So everything is working now, so far. I modified the Ports initialisation using ANSEL and TRIS and as well i did forget a return in the code after the "increaseEEADR" routine which was then displaying wierd things on the screen.

So thanks to you guys for your help. Much appreciated.

Cheers.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top