Please Help with Codelock

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

Here is the circuit diagram, It's not very big because the upload size is only 256k...

thanks
Stuart

P.S. Where do I change the target speed ?
screen_2012-02-19 22.27.25.jpg
screen_2012-02-19 22.27.25.jpg (86.91 KiB) Viewed 12256 times
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

acestu wrote: Here is the circuit diagram, It's not very big because the upload size is only 256k...
Best way is load the larger jpeg with windows paint then save as .png
Or do a screen shot, load in paint then save as png
acestu wrote: P.S. Where do I change the target speed ?
Since you have used Flowcode version 5, you will see the target speed in general options tab:
clock settings V5.png
(37.15 KiB) Downloaded 6344 times
For anyone using V4 its in View menu & Project options.

Picture is too small to check circuit is ok.
Martin

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: Please Help with Codelock

Post by medelec35 »

From what I can make out of your circuit, the connections to LCD look wrong.

The microcontroller has to be connected from D4 to D7 of LCD.
R/W should be grounded.

Also what about a pot connected for contrast adjustment?

If I was you I would look a the data sheet for your LCD, and make sure it's connected in 4bit mode.

If contrast is ok and power is 1st connected and no data is present at the data pins, then you should see a row of black squares.
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

I have reprogrammed the chip with a target speed of 4 x mhz, no difference but I have noticed that after a while the backlight does go out, do I have to connect the lcd contrast circuit only I am thinking that it is working but I just cannot see it ....

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

As stated in previous post, you will need to connect contrast circuit up (usually a pot connected between +5V and 0V. centre wiper connected to contrast of LCD)
Also are your data lines connected between D4 and D7 of LCD + R/W of LCD connected to ground?
It looks like its floating on the circuit you posted.

So my guess is you have a hardware issue.

One test you can do is at the beginning of your flowchart create a 1HZ flasher and that can drive the back light to test all is running at correct speed.
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Getting somewhere now, I connected a pot for the contrast and I can see a row of black blocks, I will check my lcd connections tommorow.

Thanks Martin
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

I am a bit confused now, the LCD connections in flowcode are Data 1 to Data 4 also Enable and RS, but you say that the LCD should be connected to Data 4 to Data 7 , is this right ?

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

acestu wrote:Hi Martin,

I am a bit confused now, the LCD connections in flowcode are Data 1 to Data 4 also Enable and RS, but you say that the LCD should be connected to Data 4 to Data 7 , is this right ?

Thanks
Stuart
Yes that's correct. I know its confusing, but in 4bit mode the 4 upper bits are used on the LCD which is D4 to D7.
In Flowcode its just the four data lines. so labelled Data1 to Data4

Take a look at the data sheet of LCD that @MM sell:
http://www.matrixmultimedia.com/datashe ... 5-30-3.pdf
That should show you the correct connections.

Martin
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

I have just rewired the LCD and used D4 - D7 , It was exactly the same and then I realized that the read write was not earthed, so I earthed it and Success I have text , it is acting a bit weird because I have got to connect the keypad again now.

I will update in a while and let you know how I go on...


Cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

Yes, everything seems to be working apart from the keyboard, only the first 2 columns seem to work, all the cables and resistors are connected, wondering if there is a test for the keypad that I can do. I have followed the wiring diagram from the keypad but I have added 10k and 330k resistors.

cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

330K should be OK. all they are doing is pulling the i/p low. so the pins don't float which is undesirable.
I guess a simple test would be: don't use keypad component just yet. Assign all connections to row as inputs.
assign all connections connected to columns as high o/p's.
in a repeat forever loop:
Read the value of input connected
Go back to beginning of loop
When pressing each key of top row in turn the value on LCD should change to the same number each time.
E.g =16 if any of top row pressed or 0 if no keys pressed.
Then with any of the keys pressed in the next row down you should get a result of 32
Then with any of the keys pressed in the next row down you should get a result of 64
Then with any of the keys pressed in the next row down you should get a result of 128

If results differ then the fault could be worked out. Probably just a connection?
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

OMG, Martin the first project that works, what a comedy of errors, I took apart the keypad and there was a dry joint inside, I can't beleive it..

Thanks so much for your patience Martin, I would of strangled me by now......


Cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

Your welcome and ....
Wow nice one!!

This is your first project, so lack of experience does make it a lot harder.
Trust me it gets easier the more projects you make.

Well done anyway!

Martin
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Thanks Martin,

I think I am going to put a couple of relays on this project with voltage free contacts so that I can control a door solenoid and an output for a digi so that it will telephone my mobile phone if the wrong code is put in. Then try and get it on a printed circuit.....Wow how exciting....

Thanks So Much
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

Just wondering how hard it would be to add a back button to the lock so that if you make a mistake putting the code in you can cancel, because I want to add a digital communicator to report a false input, I don't want to make any mistakes..

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

Hi Stuart
Attached is the easiest way that I could think of.
to cancel after you have entered a number press the # key

Martin
Attachments
Stucodelock2.fcf
(33.12 KiB) Downloaded 160 times
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

Thanks for looking at that for me , unfortunately it will not open on my computer for some reason, have you upgraded to flowcode 5 ?

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

opps
I got 2 files mixed up and thought you had posted a V5 Flowchart.
Sorry about that. :oops:
Here is correct V4 version.

Funny thing is somebody else in a different thread accidental loaded the wrong file and I said:
medelec35 wrote:I would be lying if I said I’ve never done that before. :P
See proof I wasn't lying. :lol:

Martin
Attachments
Stucodelock2.fcf
(20.79 KiB) Downloaded 167 times
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

That's Great


Thanks Martin
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

Your welcome.
So long at it all works the way you intend it too :)

Martin
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Hi Martin,

I know it has nothing to do with the programming side of this project, but would you know how to connect up a ULM2003a chip to the pic
to drive the 2 x relays, I have googled it but I don,t really understand the diagrams...

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

Hi Stuart,
What I would do is connect common (pin9)of ULM2003a to the +ve supply e.g. +12V. Pin 8 connects to 0V
Since these are open collectors, they will be sinking the load, so one end of each relay coil is connected to same + supply as common also.
The other end of the relay coils are connected to the outputs of of ULM2003a (pins 10 to 16).
E.g. ch1 output of ULM2003a is pin 16, and ch2 o/p is pin 15, so you can connect one end of relay1 to pin16 and the other to pin15
The i/p to ULM2003a (ch1 is pin1,ch2 is pin2 can connect directly to the o/p of microcontroller.
Briefly when the i/p to ch1 is high, the o/p goes low so the relay is pulled on.

Hope this is helpful.

Martin .
Martin

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Please Help with Codelock

Post by dazz »

Hi
just to add to martins post, what i would do as you want it on a board, is tie all the unused inputs to the ULM to unused pins on your pic and bring then to a connector on your pcb, as it wont cost anything and it also give ready made spare expansion if you want to add to your project in future
hth
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Please Help with Codelock

Post by acestu »

Thanks for that guys,

I am building it at the moment, just one more thing Martin, at the moment you have to press the hash key to clear the input, what would I have to do to swap it to the star button, simply because the star button on my keypad says "clr" on it, I take it that it is the part of the code that says if keypad = 11 , 11 I am guessing is what the hash key returns, If that is the case I don't know what the value of the star key returns...

Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

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: Please Help with Codelock

Post by medelec35 »

All you do is change all the references from 11
to 10

So you should have:
If keypadnumber = 10

Martin
Martin

Post Reply