Like to read Port B then send to Port D

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Tue Feb 03, 2015 11:19 pm

Correct the LED wiring

Still just get BLACK squares
Attachments
LED2.jpg
LED2.jpg (19.65 KiB) Viewed 8749 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Wed Feb 04, 2015 12:10 am

Row of black squares is either uninitalised because of wrong or poor connections or connecting LCD after target device has been powered up.

Contrast could be a bit too high.
If far two high then you will get two rows of black squares.
Make sure all connections are correct(including R/W to GND)
Make sure itself that contrast controls does change contrast ok.
Check on the contrast voltage on LCD itself covers the full range.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Wed Feb 04, 2015 6:43 pm

Still working on the LCD.
I double checked and the wiring looks good.

I think I will do away with the jumper leads and run wire to the ports. I had this problem once before with the jumper wires causing interference.

I tried a 10K pot to see if it would help but no luck.

Back to triple check the wiring.

John

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Thu Feb 05, 2015 8:05 am

Hi Martin,
I have searched the internet till my eyes are getting sore.

I was looking at the Flowcode action of the servo's and they work like the breadboard actions other then the LCD.

What I did notice is the PIC and noticed that DATA 3 ( Pin 18 ) RC3 never changes state even when the LCD changes ?

Also RC5 ( Pin 24 ) is the Enable and it never flashes.

John
Attachments
LCD3.jpg
LCD3.jpg (48.06 KiB) Viewed 8738 times

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Mon Feb 09, 2015 12:15 am

It was very surprising that the PIC 16F1937 was causing the problem with the LCD.

Glad we got down to the route of the problem in the end.
What through me was the resistance with LCD disconnected between pin pin12 and grown resistance was lower than it should have been.

You can load the servo test program and watch the LCD change as servo changes.

Changed the PIC and we know have it working

Martin thank you for helping figure it out.

Here is a picture of the now working LCD

John
Attachments
LCD Test.jpg
LCD Test.jpg (101.16 KiB) Viewed 8729 times
These users thanked the author JLeith for the post:
medelec35 (Mon Feb 09, 2015 9:16 am)
Rating: 5%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Mon Feb 09, 2015 10:17 pm

Hi John,
Yes it was an odd fault.
The 16F1937 could not pull down on C1 (Sink) , but could source.
The cause could be trying to pull down a 5V supply?

Anyway as per request via PM, I have guess at what an extra 5 deg would be.
If this don't work, then perhaps the other way would be to use a pot to set the servo.
LCD will display the ADC value of pot so we know what the correct value to use for the servo.

Martin.
Attachments
Servo test2.fcf
(58.2 KiB) Downloaded 115 times
Servo test2.hex
(11.38 KiB) Downloaded 118 times
These users thanked the author medelec35 for the post:
JLeith (Sat Mar 28, 2015 6:18 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Wed Feb 11, 2015 10:54 pm

Thank you

Your help is appreciated beyond the great pond.

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Thu Feb 12, 2015 7:21 pm

Hi John,
Your welcome.

Attached is a basic Servo position tester.

Just connect pot center wiper to AN1( pin 3 of 16F1937). via a resistor say 4K7 to 10K,
Purpose of resistor is to protect both microcontroller and pot if pot o/p is say set to 5V and microcontroller that's connected to pot wiper is accidentally set as 0V o/p.
The left pin of pot to ground (so when turned fully ccw there will be 0V across wiper and GND) right side of pin connect to +5V.
Attachments
Servo test3.hex
(10.57 KiB) Downloaded 101 times
Servo test3.fcf
(11 KiB) Downloaded 114 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Fri Feb 13, 2015 11:04 pm

Great program for setting the Servo

LCD = 1 ( Zero )
LCD = 215 ( 90 Degree )

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Sat Feb 14, 2015 1:24 am

Thanks.
At least we know what values to use for the servos now.
I will see if I can put it all together.
The only thing is with the timing diagram is events look like that are occurring simultaneously.
Is that how it's going to be in real life?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Sat Feb 21, 2015 4:05 pm

Hi John,

Attached works for me even with portB changing every 1ms

but I'm not using same hardware as you to pull port B and A4 down

Martin
Attachments
Segment control to Servo v11.hex
(17.01 KiB) Downloaded 94 times
Segment control to Servo v11a.fcf
(66.49 KiB) Downloaded 90 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Sat Mar 07, 2015 6:25 am

Hi Martin

Posting the actions of the New PIC's

Well the new chip is in and the circus must be in town.

Not working or is working to perfect

I have tried setting the PIC16F1827 time delay
From 30 msec to 1000 msec

Nothing I can't get the 1937 to pick up the PortB bits.

The timing around 250 is the best when it only see the ( B ) and not the (C)

The PM is not working

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Mon Mar 09, 2015 12:07 pm

Hi John.
Attached is an improved display version.
JLeith wrote:Nothing I can't get the 1937 to pick up the PortB bits.

Since we have established that A3 line on hardware was High when it should have been low, the attached version uses B7 to clear rather than A3
You will now know at the start of segment changes, and in idle state what digit or clear board has taken place.
For example while segments are changing:
LCD Digit2.png
LCD Digit2.png (4.96 KiB) Viewed 8628 times

When Idle:
LCD idle 1.png
LCD idle 1.png (1.44 KiB) Viewed 8628 times

&
If clear board:
LCD idle 2.png
LCD idle 2.png (1.31 KiB) Viewed 8628 times


Hope you like the improvements :)

Martin
Attachments
Segment control to Servo v29.fcf
(71.49 KiB) Downloaded 108 times
Segment control to Servo v29.hex
(18.65 KiB) Downloaded 93 times
These users thanked the author medelec35 for the post:
JLeith (Sat Mar 28, 2015 6:17 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Mon Mar 09, 2015 5:15 pm

Hi Martin

Version 29 looks like a master chief creation and it looks like a dream is coming true.

Yes the added touch of knowing what digit it is working will make it a lot easier. I did find I had several flipped code on the 1827 for the Inning display

I will let you know how it works in the mystery world across the might pond.

John

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Mon Mar 09, 2015 5:20 pm

Martin do you have a moment to Skype.

Version 29 is having a mild stoke........ Servo and LCD are drumming to a beat.

I would like to show you.

I'm on Skype

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Mon Mar 09, 2015 5:31 pm

Hi John,
At work which is where I modified flowchart, so not tested it on hardware.
Be home at about 5.30, so I can send flowcode to target & see what is going on then.

Can you load a different version to check, as it could even be a power supply issue?

Martin
These users thanked the author medelec35 for the post:
JLeith (Sat Mar 28, 2015 6:17 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Mon Mar 09, 2015 5:37 pm

Not a problem I reloaded V28 and the world is safe.

If you have a quick minute at 5:30 I will be here.

I reloaded V29 and it dancing. Nice beat

Not sure why the power supply would affect 29 and not 28.

But I know the answer is in the weeds and we will find it.

John

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Mon Mar 09, 2015 6:28 pm

Hello Martin

Well the wizard has a magic hat.

Odd Version 28 is drawing 2.6 Amps

Version 29 is drawing 3.5 - 4 Amps . Due to the Servo chattering

The Servo at rest draw 1/ 2 amp.

I have placed a order for a 12 Amp 5 Volt supply. About $55 ( 29 Pounds )

It is Switching Mode unit as you suggested.

John
Attachments
67-0560.gif
67-0560.gif (63.01 KiB) Viewed 8617 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Sat Mar 28, 2015 1:12 pm

Hi John,
If that power supply is not up to the job either, then it could be a hardware fault or software design issue.

With the new method of hardware selection by RS232, I cant see the issue Servo 0 not working for digit 2
Here is a screen shot of Guest outputting portD for digit 2:
Digit 2.png
(144.22 KiB) Downloaded 3045 times

From the screen shot you can see what pulse duration is for each of the pins on port B.
If you can test the files on your hardware and let me know how you get on.

Cheers

Martin
Attachments
Segment control to Servo RS232 v3 Guest.zip
(29.79 KiB) Downloaded 81 times
These users thanked the author medelec35 for the post:
JLeith (Sat Mar 28, 2015 5:36 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Sat Mar 28, 2015 5:40 pm

Thank you for all your endless time in working through the endless events.

I believe the new power pack for the 5 Volts should be well in the range. It is a 12 Amp unit and my measurements are with a low tech meter indicating the max draw is 7.2 Amp when a digit 0 is cleared and all 7 Servo are in action.

Yes I will test all the Displays on the servo action.

Thank you for the updates.

John

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Sat Mar 28, 2015 6:17 pm

Hi Martin

Testing for Digit 2 works wonderful

Found a glitch with Digit 9 not activating in:
Guest
Home
Inning

These are the only displays that go 1 to 0

I did the Break point and for Digit 8 it triggers at the decision but Digit 9 doesn't make the decision ?

I will try and debug

If you have a moment maybe you can spot it.

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Sat Mar 28, 2015 7:18 pm

Hi John,
Your welcome and thanks.
JLeith wrote:Testing for Digit 2 works wonderful

Glad it's working.

JLeith wrote:Found a glitch with Digit 9 not activating in:
Guest
Home
Inning

I have spotted the issue.
I have added

Code: Select all

(RS232ReceveMode) && ((RXData < 57) && (RXData > 47) || (RXData = 99))
to prevent wrong data being sent to score board.
It should have been

Code: Select all

(RS232ReceveMode) && ((RXData < 58) && (RXData > 47) || (RXData = 99))
since with RXData < 57 then code 0 to 8 only is within range.
Try the attached files.
Can you let me know if they are all correctly updated as I thought I sent a non updated one back before?
Attachments
Segment control to Servo RS232 v4.zip
(44.95 KiB) Downloaded 90 times
These users thanked the author medelec35 for the post:
JLeith (Sun Mar 29, 2015 6:53 am)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Sun Mar 29, 2015 6:52 am

Thank you

The missing 9 is back at the party.

I tested Guest and will test everything to ensure it is all working

Great work Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: Like to read Port B then send to Port D

Postby medelec35 » Sun Mar 29, 2015 10:28 am

Thanks John,
Fingers crossed all will be working, esp when all connected together.

Did you notice I have separated each transmitted Character by a 10ms delay?
This is to increase receiving reliability.
When a char is sent the Rx interrupt is triggered no matter what part of the software is being accessed at the time.
The exception being the interrupt itself!
If the interrupt macro has not yet finished, and another char is sent, then that char will be missed.
This is because when ISR (interrupt service routine) is triggered, all the interrupts are disabled until ISR macro is exited.
With 10ms delay the ISR macro will have exited before next char is sent.

Martin
These users thanked the author medelec35 for the post:
JLeith (Sun Mar 29, 2015 6:34 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
JLeith
Posts: 521
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 143 times
Been thanked: 26 times
Contact:

Re: Like to read Port B then send to Port D

Postby JLeith » Sun Mar 29, 2015 6:41 pm

That is excellent to add the 10 ms delay.

I know it has happened where I have pressed the button a second time to ensure it was received.

Yes this will make a smother flow with less errors.

I will try and complete each segments working with the servo's.

I need to work out a angle measurement tool so I can attach the horn at the right angle so when it is a 0 degree the cradle will be at 90 degree vertical and when it flips to 216 the cradle will be horizontal.

I will keep you up to date on the development.

Again thank you for your support

John