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.

Migration from 16LF84A to 16F628A

mdanh2002

Member
Hi,

My attached code to test a 16x2 and 20x4 LCD using HD44780 controller has been working well on a PIC16LF84A for a while. It is based on the code from **broken link removed** and simply displays some text strings at various lines on the screen. A digital input at RA3 will select the LCD in use, either 16x2 or 20x4 LCD.

Today I tried to migrate it to PIC16F628A. It compiled with no modifications but does not work properly. With the new PIC, the LCD is initialized properly (screen is cleared, cursor is shown and moves to correct line) but no character is displayed. It seems that the controller does not understand the character ASCII code sent as data via PORTB, yet understand the command code sent via the same port.

Any advice is appreciated. I wasted my whole evening on this. Thanks in advance
 

Attachments

I don't use C, but I can't see anywhere in that code that tells the compiler to use the 16F628?, you need to tell the compiler to create code for the exact PIC you're using, you also need to disable the analogue comparators on the 16F628.

It looks like you're simply creating code for the 16F84 still?.
 
I don't use C, but I can't see anywhere in that code that tells the compiler to use the 16F628?, you need to tell the compiler to create code for the exact PIC you're using, you also need to disable the analogue comparators on the 16F628.

It looks like you're simply creating code for the 16F84 still?.

Thanks. I am using MPLAB with Hi-Tech C (Lite) compiler. I use the project wizard and select 16F628A as the target device. The output window shows the command line argument specifying that 16f628A is being used. So I believe my settings are correct.

Which register should I use to disable the analog comparator?
 
Last edited:

Latest threads

Back
Top