URGENT help on PIC16F1827

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: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: URGENT help on PIC16F1827

Post by JLeith »

Hi Martin\

You are 100 % right it is RA3 I don't know how I pick up RA6 in my drawing.

I double checked and it is RA3

My apologies. I posted the wrong image before. I had the right thought but not the correct images.

So we now are on the right path. Thank you
Attachments
RA3.jpg
RA3.jpg (8.54 KiB) Viewed 11801 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

Hi Just started modifying your Flowchart.
JLeith wrote:Martin can I use ( RA1 ) it looks to be the same as (RA0) ?
Only problem is within Ball_Dispaly macro for example you're using RA1 when Ball = 2
I would recommend not sharing RS232 with other outputs.
Perhaps you would like choose another pin?

Martin
Martin

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Hello Martin,

My mess.
On Ball macro yes there is ( A1 ) ( A2) ( A3 ). And any other A? can be removed.

A1 -- 2 -- 3) I was using them to follow the action to see if I ever entered the Ball 2 and three.

Only RA 0 in use is RA 0 for control of the Bank Selection

Only RA 4 is used for Pulse length timing. When the RC timing is running it send the result to RA0 and stops the +12 going out to the Segments.

I was not sure if could use locked in delays for RA 0 for 250 msec or keep with the original design for the RC on RA 4.

Martin you will see that I added 2 sec delays in the Ball Macro to aid in me seeing the ON segment being produced on the VANS. Martin is there a better way to list the delays say in a Macro and when the time comes and I can shorten I could address 1 spot.

I worry when I go into the other Macros and add the 2 sec delays I will run out of CHIP memory ??

Martin if you can see ways to improve please indulge I have nothing to loose.

John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

JLeith wrote:Martin is there a better way to list the delays say in a Macro and when the time comes and I can shorten I could address 1 spot.
What I would do, is instead of a fixed constant for delays (e.g 2 sec Delay)
Use a variable int for delay and set delay for milliseconds.
At the start of Main you can assign variable with how many milliseconds you want delay to last for.
E.g

Code: Select all

Time_Delay = 2000
I will implement that and RA changes for you.

Martin
Martin

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Thank you Martin,

I was sure there must be a better way to address the Timing. Excellent knowledge.

Yes you might find the RA settings in some of the other and they were just to give me a glimmer in how this mystery PIC works or in my case not work.

I really appreciate your time and energy.
jump happy.jpg
jump happy.jpg (5.9 KiB) Viewed 11795 times
Martin as I was typing this message and I'm a 2 finger typer the cable has arrived.

ODD there is no manual with it ???

Color wires are ( White ) (Red) ( Green ) ( Black )

John

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

Re: URGENT help on PIC16F1827

Post by JLeith »

I think I found the wire label.
TTL cable.jpg
TTL cable.jpg (10.96 KiB) Viewed 11794 times
Do you think this is correct
RED = 5 Volts
Black = GRD
White = RXD
Grenn - TXD

Now in our case we will be using
RED - connect to 5 Volts
Black - connect to GRD
Green - for TXD to the USB connected to the Laptop

John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

Your welcome John.
JLeith wrote:Color wires are ( White ) (Red) ( Green ) ( Black )
You will be using Black for GND and White RA1
Not using any other colours.
White is because Host TTL to USB adaptor is plugged into is Receiving RS233 (not transmitting)

Did you receive a drivers disk as well for TTL to usb adaptor?

I noticed timer0 Interrupt is using RA1, I assumed this is not required as well?

I need to stop for the night (Now 23:44 in the UK), will PM you flowchart tomorrow along with hex file when I get home from work.
I can then help you set up laptop to display all your variables.
You can even capture a log of the variables and work out what the issue is (hopefully :) )
Martin

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: URGENT help on PIC16F1827

Post by kersing »

John,

I would not connect the 5V to your circuit. It is usually an output from the PC (the USB bus carries 5V to power devices) and you project has its own power. If you have a multi meter available you check it there is a voltage if you just connect the USB plug to you computer and nothing (besides the multi meter) to the wires.

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Evening Martin

Yes it getting late for you. I forget the time difference I'm off tonight to Umpire a Baseball game.
You will be using Black for GND and White RA1
I will solder in the connects tomorrow morning.

I think the RA1 in the timer0 is not needed.
Did you receive a drivers disk as well for TTL to usb adaptor?
No driver disk. I will check with the supplier maybe it is a stand alone download.

Is there going to be light at the end of the tunnel.

Talk to you tomorrow.

If it is easier I could call you on the telephone. Just not sure when you get home.

If you think this would be easier to talk on the phone send me your telephone number.

John

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: URGENT help on PIC16F1827

Post by Brendan »

Hi John.

I had a little more time to review your code and I think I discovered a possible problem.

When you first start the code, Port B is initialised as an input and awaits button press. However, after executing the Ball function, the loop does not expressly return Port B to an input in preparation for the next button read. Flowcode responds by assuming that the switch in the IDE is directly connected to the port but, in reality, if the multiplexed port remains an output immediately prior to a read then the switch may well not be able to overcome preloaded line capacitance via the resistors connecting the switches to Port B.

All the best,

Brendan
Last edited by Brendan on Sat May 11, 2013 6:10 pm, edited 2 times in total.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

Hi John.

Just been randomly activating switches.
This is what was displayed:
RS232 display.png
(87 KiB) Downloaded 6406 times
To set up Hyperterminal:
First you need to establish what com port TTL to USB converter is using.
With Vista and windows7 I just clicked on Start, Computer, System Properties (From top menu. You can also run device manager from control panel) , Device manager.
In device manager expand: Ports (COM & LPT) by clicking on it.
The Com port TTL to USB converter should now be shown (make a note of it).
Close Device manager and now run Hyperterminal and enter a name for your new connection.
When OK is selected, you should see correct port displayed in Connect using: box. if its wrong then select correct port, then OK.
Just change Flow control to None.
You should have:
Bits per second:2400
Data bits:8
Parity: None
Stop bits:1
Flow control: None

With all the switches off you should get real time elapsed in seconds.
You will be notified if program is resetting, also clear from runtime displayed in seconds (1 to 32767)

Would you like both files pm'd or just post on here?

Martin

Edit: Just corrected Gust to Guest
Martin

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Working thru you message

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Don't see the TTL in the Ports (coms & LPT )

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

Re: URGENT help on PIC16F1827

Post by JLeith »

See "Other devises with ???? USB-Serial Controller

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Checking the Driver install

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

Re: URGENT help on PIC16F1827

Post by JLeith »

PM is easier

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Did the program work on your system

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

Drivers need to create a VCP (Virtual Com Port)

I have two TTL to USB converters here.
One shows this:
VCP1.png
(35.14 KiB) Downloaded 6401 times
The other TTL to USB shows this:
VCP2.png
(40.79 KiB) Downloaded 6401 times
Is sounds to me like either correct drivers for your device are not installed or the VCP part is not installed?
Martin

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Agree I think I have to remove some memory on the laptop.

Why is the world of laptops so hard some times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

I just think you have been sent the wrong drivers?

I will have a search.
Martin

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

Re: URGENT help on PIC16F1827

Post by JLeith »

I have the Prolfic USB to Serial Comm Port ( Com4 ) under Ports (Com & LPT )

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

Re: URGENT help on PIC16F1827

Post by JLeith »

I have set the Speed to 2400

Now it says com4 is that the USB port ?

Ok now what is my next step

John

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

Thats Great!
So the web site I pm'd to you that contained drivers was correct :)

You need to follow what I posted about setting up hyperterminal with Connect using: set at Com4

Next you need to load attached hex file into your programmer and program 16F1827

Connect Black lead to GND and RXD (White) to Port A1

If all is working, you should see text and values within hyperterminal window,
Martin

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

Re: URGENT help on PIC16F1827

Post by JLeith »

Excellent.
I loaded the Martin Hex into the chip.

Loaded by PICKIT 2.

Martin if I load the FLOWCODE will it work with my Home version and load the PIC ??

Odd when I powered it up the new LED did not come on ??

Now the laptop is in the basement and my main PC is on the top floor.

off to see what the laptop tells me.

Back soon.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: URGENT help on PIC16F1827

Post by medelec35 »

JLeith wrote:Martin if I load the FLOWCODE will it work with my Home version and load the PIC ??
The only thing you can do with the Flowchart is run a simulation. If you try to compile to hex or target, then I would assume you will get some error or warning associated with RS232.
JLeith wrote:Odd when I powered it up the new LED did not come on ??
LED connected to Port A3 is flashing for me on my hardware,
Well solid for the first 5 seconds, then flash every second.
Martin

Post Reply