EB006-8 LCD problem with PIC16F1937

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

Hello

I am working on my last years project, where I need to make a bluetooth connection with my phone and a robot.
The problem is, I was testing this at school, but when I try it at home, the LCD is acting weird.

when I upload a simple program that just shows "TEST" on the displays, It sometimes shows arrows and underscores or the upper line of the LCD is just black.

I am using the version 8 EB006 programming board, but I don't know if it are problems with the configuration, or with the driver to program the board. I was having problems installing the driver on my windows 8 pc, because the driver wasn't digitally signed, and the security of windows 8 was blocking it. I do have the driver now, but the LCD acts weird.

Can someone tell me what's the problem?

thanks.

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Crenwick »

Hello

Do you use the EB005 lcd display or a custom ?

When you use the EB005 (DEFAULT jumpers set) then connections are by default set to PortB (0-Bit0,1-Bit1,2-Bit2,3-Bit3,4-RS,5-E) when using component.

My bed is to re-check these six connections.

Regards,
Bernard

Flowcode 6 / EB006-V9

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

Yes I am using the EB005, I've checked all the connections, but everything is connected correctly, the LCD is also connected to PORT B of the programmer board.

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Crenwick »

Witch PIC are you using, you can attach your .fcf file if you want so we can test it.
Bernard

Flowcode 6 / EB006-V9

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

I am using the bluetooth solutions board with a PIC16F1937. The program I am trying to use is a program directly from the matrix multimedia site. (the only thing I have to do is to schange the chip in the program) This program has worked once before on school.
This program is attached (the chip in the program is still the 16F977A, but before I upload, I change the chip number tot 16F1937)
I've already tried to change the printASCII's into printstrings, and I've also made a brand new program to just print the string "TEST", but that won't work either.
Attachments
commando's lezen.fcf
(16.32 KiB) Downloaded 142 times

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Crenwick »

Can you test this file ?

I removed the bluetooth component and changed pic to 16f1937.

LCD works on my board without problem with this code.

One thing also, I had to rename your file because of " ' " sign not recognized by compiler.
commando lezen.fcf
(14.09 KiB) Downloaded 206 times
Bernard

Flowcode 6 / EB006-V9

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

I can't open your file, it says "unexpected file format" But I've tried making a new program, called flowcode1, and that one didn't work either.
I think it is something with either the board itself or The EB006 v8 USB driver, I had problems before downloading the compiler because it said that there were soms changes after the final edition, so it wasnt digitally signed.

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

I think that the code's are sent wrong, for example:

If I send a program that keeps wirting a "2", this is what I get:
http://prntscr.com/3o20by

If I send a program that keeps wirting a "3", I am getting this:
http://prntscr.com/3o20gy

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

It seems to be a problem with the crystal on the board, when I change the program to use the internal clock, the display works.
But if I try to put a bluetooth command in the program, the program stops at that command.

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Crenwick »

The standard delivered quartz on EB006 board is a 19.6608Mhz . That should match the settings in Flowcode.
Bernard

Flowcode 6 / EB006-V9

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

It is the right crystal, and the settings in flowcode are also for that crystal.

Do you need to put the connector above it on OSC or on A6&7? It s now on OSC.

kersing
Valued Contributor
Valued Contributor
Posts: 1961
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by kersing »

Set it to OSC to use the crystal. I found in the past it sometimes helps to remove the jumpers and reseat them.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

that doesn't help, I am working on the internal clock now, but I can't figure out how to send the setup commands without the bluetooth commands (if I use buetooth commands the program freezes, if I use RS232 signals, the commands are send but I can't connect to the board)

kersing
Valued Contributor
Valued Contributor
Posts: 1961
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by kersing »

Have you tried the basic one second flasher to see if your oscillator settings are correct? Just create a loop that turns a led on, delay 1 second, turn led off, delay 1 second. Use a stopwatch time the amount of time required to have the led turn on 10 times. That should be 20 seconds (or very near). If not you clock is not working as expected.

The bluetooth module is connected to the serial port of the controller. If the clock setting are not right the serial port will not use the correct baud rate, probably resulting in the bluetooth module not understanding anything the controller sends it.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

the problem is, I don't have any led's nearby. The only thing I have is the bluetooth solutions kit with a LCD, a keypad, 8 buttons and the bluetooth component.
But the display only works on the internal clock, but than the bluetooth component doesnt work because the baud rate is wrong.

kersing
Valued Contributor
Valued Contributor
Posts: 1961
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by kersing »

Which version of flowcode are you using?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

flowcode V5.2

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

I've update to v5.5.2.1 now but it won't work

kersing
Valued Contributor
Valued Contributor
Posts: 1961
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by kersing »

Two (of many) ways forward:
1) You create a simple 1 second flasher (LED connected to port A0) with all the right settings for a 19.6608MHz crystal and I'll upload it and provide you with measurements.
2) You find a shop selling a LED and a resistor, invest about one euro and you'll be able to test yourself.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

I don't have the bluetooth tolutions board at home now, It is back at school, so I don't need any more help on this.
Thanks for the help anyway.

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Benj »

Flowcode v5 did have a problem with the LCD and the 16F1937 device.

Basically the device has a Port and Lat register and the standard LCD component code defaulted to Port instead of Lat for the device which at 19.6608 MHz results in read/modify/write type glitches.

I believe we fixed this for 5.5 but you can check by looking at the C code, the bug free version should look something like this.

Code: Select all

#ifdef FC_CAL_PIC
   #if MX_CLK_SPEED >= 32000000
	#define %a_PORT0    lat%b
	#define %a_PORT1    lat%c
	#define %a_PORT2    lat%d
	#define %a_PORT3    lat%e
	#define %a_PORT4    lat%f
	#define %a_PORT5    lat%g
   #else
    #ifdef MX_LCD_PORT_LAT
	 #define %a_PORT0    lat%b
	 #define %a_PORT1    lat%c
	 #define %a_PORT2    lat%d
	 #define %a_PORT3    lat%e
	 #define %a_PORT4    lat%f
	 #define %a_PORT5    lat%g
    #else
	 #define %a_PORT0    port%b
	 #define %a_PORT1    port%c
	 #define %a_PORT2    port%d
	 #define %a_PORT3    port%e
	 #define %a_PORT4    port%f
	 #define %a_PORT5    port%g
	#endif
   #endif
  #else
	#define %a_PORT0    port%b
	#define %a_PORT1    port%c
	#define %a_PORT2    port%d
	#define %a_PORT3    port%e
	#define %a_PORT4    port%f
	#define %a_PORT5    port%g
  #endif 
and the define "MX_LCD_PORT_LAT" should be in the code from the FCD file which is right at the top of the generated C file.

If you need to override then use the custom code on the v5 LCD component to set the #if in the defines code section to something like this.
#if MX_CLK_SPEED >= 16000000

Debleu-TL
Posts: 13
Joined: Thu May 29, 2014 1:11 pm
Contact:

Re: EB006-8 LCD problem with PIC16F1937

Post by Debleu-TL »

I am getting this code in the V5.5.2.1:

Code: Select all

  #ifdef FC_CAL_PIC
   #if MX_CLK_SPEED >= 32000000
	#define LCD_1__PORT0    latb
	#define LCD_1__PORT1    latb
	#define LCD_1__PORT2    latb
	#define LCD_1__PORT3    latb
	#define LCD_1__PORT4    latb
	#define LCD_1__PORT5    latb
   #else
    #ifdef MX_LCD_PORT_LAT
	 #define LCD_1__PORT0    latb
	 #define LCD_1__PORT1    latb
	 #define LCD_1__PORT2    latb
	 #define LCD_1__PORT3    latb
	 #define LCD_1__PORT4    latb
	 #define LCD_1__PORT5    latb
    #else
	 #define LCD_1__PORT0    portb
	 #define LCD_1__PORT1    portb
	 #define LCD_1__PORT2    portb
	 #define LCD_1__PORT3    portb
	 #define LCD_1__PORT4    portb
	 #define LCD_1__PORT5    portb
	#endif
   #endif
  #else
	#define LCD_1__PORT0    portb
	#define LCD_1__PORT1    portb
	#define LCD_1__PORT2    portb
	#define LCD_1__PORT3    portb
	#define LCD_1__PORT4    portb
	#define LCD_1__PORT5    portb
  #endif
But I don't have the bluetooth solutions board anymore (it is back at school now) And I'm testing directly on the Elektor Proton robot with a 16F887, so I don't have the problem anymore.

But thanks for the help.

Post Reply