| View previous topic :: View next topic |
| Author |
Message |
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
|
Posted: Mon Oct 19, 2009 12:58 pm |
|
|
| sorry, I forgot... 470 ohm |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 19, 2009 1:08 pm |
|
|
Why do you need to use the 2nd circuit, where you externally supply
+5v to the anode of the LED ?
I always use the first circuit, where the PIC supplies the +5v to the
anode of the LED (through a resistor), and the cathode is grounded.
Why not just do it that way, since it works. |
|
 |
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
|
Posted: Mon Oct 19, 2009 1:14 pm |
|
|
I tried the second circuit just to find a difference between RB6 and RB1.
Because using B6 and B7 the LCD doesn't work! (but it works using B0 and B1). |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 19, 2009 1:28 pm |
|
|
Do you mean that RB6 and RB7 don't work with any LED circuit ?
They never work ? |
|
 |
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
|
Posted: Mon Oct 19, 2009 1:33 pm |
|
|
If I use RB6 and RB7 to command the display, the lcd display doesn't work.
The only one way to see the LCD working is use different pins (like B0 and B1) |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 19, 2009 2:21 pm |
|
|
Instead of asking more questions, I just decided to install vs. 3.160 and
jumper my PicDem2-Plus to your configuration. I made it work.
The problem is that your version of the compiler has bugs for the 16F88.
I used the LCD connections that you specifed in an earlier post:
| Code: |
#define LCD_DB4 PIN_B4
#define LCD_DB5 PIN_B5
#define LCD_DB6 PIN_B6
#define LCD_DB7 PIN_B7
#define LCD_E PIN_B3
#define LCD_RS PIN_B2
//#define USE_LCD_RW 1
|
Then I modified the test program, to add the four lines shown in bold
below. These lines fix problems with your version of the compiler.
Your version of the compiler does not setup the Analog pins as digital i/o.
Also, the setup_adc_ports() function doesn't work correctly. So, I used
a #byte statement to define the address of the ANSEL register and then
in main(), I set it to 0, which makes all pins be digital. Also, the A/D
converter is turned on by the CCS start-up code, and that's not needed,
so I turned it off by writing 0 to the ADCON0 register. Then it works.
Add the lines shown in bold below:
| Quote: |
#include <16F88.h>
#fuses XT, NOWDT, NOLVP
#use delay(clock=4000000)
#include "flex_lcd.c"
#byte ADCON0 = 0x1F
#byte ANSEL = 0x9B
//=====================================
void main(void)
{
ADCON0 = 0; // Disable A/D converter
ANSEL = 0; // Set i/o pins to be all digital
lcd_init();
lcd_putc("\fHello World");
while(1);
} |
|
|
 |
webgiorgio
Joined: 02 Oct 2009 Posts: 123 Location: Denmark
|
|
Posted: Tue Oct 20, 2009 1:10 pm |
|
|
oh wow, thank you very much!
I was thinking that there was something wrong on my software and hardware. Fortunately it isn't!
Ok, the problems changing from 16F84 to 16F88 came just from using old compiler version.
thank you very much! |
|
 |
anhcmut
Joined: 02 Jul 2011 Posts: 1 Location: ho chi minh-viet nam
|
| 16f84.h |
Posted: Sat Jul 02, 2011 11:57 pm |
|
|
have you got the 16f84.h ? could you post in the website ?
thank you very much !
++++++++++++++++++++++
See Forum Rule #10:
10. Don't post the CCS example code or drivers, or ask for such code and drivers. (including header files).
-- Forum Moderator
++++++++++++++++++++++ |
|
 |
|