Alarm - getting started

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

Post Reply
christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Alarm - getting started

Post by christoph »

Hi everyone – just to let you know, this is my first time posting on the forum and whilst I am reasonably OK with the discreet component design and construction, I have absolutely no knowledge of micro-processors whatsoever but decided to purchase Flowcode4 and the Version 3 PICmicro development board ‘HP488-00-3’ to enable me to use PIC’s without getting involved with ‘programming’.
After many hours of reading through all the available Matrix Multimedia documentation and familiarising myself with all the basics concerning switches, LED’s, analogue inputs, the provided examples and web tutorials etc., I have reached the stage where I can programme a PIC successfully with an example as a start (even though I still don’t understand some of it!). I thought now would be a good opportunity to try using a PIC for a project which is currently my priority but - not for want of trying - I find it really difficult to see how to go about it. The nearest Flowcode4 example I have been experimenting with over several days is the ‘RFID EX9.fcf’ but I’m not having much luck and I really want to use the PIC16F88 – not the ‘16F877a’ which is being used in that example. I feel I may be on the wrong track and I realise now, how much more experience I need to use even this high-level approach so.... If anyone can enlighten me on the best approach I would be REALLY REALLY grateful!
Basically it is an alarm system with 12 inputs (using a single UART input pin into the PIC). The object is simply to use the PIC16F88’s output pins to light just ONE out of 12 LED’s on a ‘first-up’ alarm basis and hold it (ignoring any further inputs until ‘system reset ‘ which for my purposes is power ‘off’ then ‘on’).

The ‘Received Input Signal Data Format’ (into the PIC) is a single 9600,N,8,1 Serial UART (sourced from a RF receiver module’s single output) and is composed of a ‘packet’ of 5 Bytes (taking approximately 5mSec) every 16mSec or so, therefore there is approx. 10 or 11 mSec HI after packet end and before ‘0’ start bit for the next packet. The ‘5 bytes’ indicate which of four RF Tx modules is sending an alarm and which of three inputs on each module is being activated (hence the 12 inputs). It can be seen therefore, that the PIC is required to have a pre-programmed reference for each module and each of the 3 inputs for the module. This is all provided in the 5 bytes: Byte 1, bits 4,5 and 6 give the activated input and Byte’s 2,3,4 and 5 give the module’s identification. All in binary at 0v to 3.6v. I am aiming to get the necessary reference data into the PIC by switching from ‘alarm’ to ‘set-up’ and closing each alarm contact for 4 sec one after the other.

Hopefully, that all makes sense!

Chris

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Alarm - getting started

Post by allpicproject »

Hi Chris,

It's better if you share your work first. So anybody can have look on it.

Zuki

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi Zuki, This is only conceptual at the moment!

Cheers,

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi all - I am trying out Matrix Multimedia's 'Examples, Components, RS232, 3.SoftwareUART 16F88.fcf' using 'Component' ADC0 for a convenient input and a LED array. That all works fine and the result is indicated in the 'sent' box but I have tried many different ways to get the 'receive' box to show ANYTHING at all. Can anyone give me a clue why this is not working?? :(

Cheers,

Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Alarm - getting started

Post by Benj »

Hello Chris,

To get the receive simulation working you need to click the plus icon on the RS232 component while the simulation is running. You can then add characters to the incoming queue and then when you perform a RS232 read a byte will be moved from the queue to the received window.

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi Ben'
Ahhh... thankyou, thankyou for that - I can't understand why I never did that to try whilst simulation was running!

So if I type in the 5 hex bytes of the UART code '10 31 4C E6 86' (or can I/should I, type them in as 1's and 0's) this would emulate that same UART 0 to 3.6v code that would eventually be my same hardware input signal into the chip when programmed? HOW DO I TIME THAT in the same way as the original signal (which is presented as a signal by my receiver module manufacturer) i.e. about 1 mSec for each of 5 bytes in a 'packet' every 16 mSec. So there is about 11 mSec space between. I do understand the requirements of the UART etc. but dont know how to apply that here.

Many thanks Ben,

Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Alarm - getting started

Post by Benj »

Hello Chris,

The input accepts numbers in decimal so for hexadecimal you will probably have to input the numbers like this.

0x10,0x31,0x4C,0xE6,0x86

The receive signal will just be assumed and no delay will be present in the simulation. On the hardware the UART will buffer incoming bytes so the RS232 Read macro only pulls off a complete byte when it is ready. Delays in between transmissions should not effect the receive functionality.

Note that if you are using the software RS232 mode then there is no buffering and you have to ensure you are polling the receive macro often enough to collect the bytes as they come in.

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi Ben'
Many thanks for your reply. OK, but whilst I can use decimal inputs in software mode (which I am initially whilst I get the rest of the flowchart together) how does one cope with the incomig hardware hexadecimal bytes when I connect to the UART-programmed PIC16F88?

Best regards,

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Anyone know as I am not able to change the hex source from hardware?

Thanks for any help on that

Chris

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Can anyone help?

IS IT POSSIBLE TO READ HEXADECIMAL ON THE LCD (currently a hex input is reading hex on EEprom but decimal on LCD)?

Thankyou in advance,

Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Alarm - getting started

Post by Benj »

Hello Chris,

Flowcode v4 has a string manipulation function available for doing this.

Using a string manipulation icon.

string = NumberToHex$(int)

Then simply pass the string variable to the LCD and job done.

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi Ben,

Thanks for that - not quite sure how I apply it but I will work on it.

Driving me mad is how to increment EEPROM locations with each hex byte over 60 locations as a pseoudo UART replication in slow motion?

And a simple but vexing question - how do I put general text on the flowchart (not the comments ones)

And VERY IMPORTANT about THANKING FOR REPLIES...... I clicked the thumbs up sign on your reply and it appears as a thumbs down so I tried to change it and it said do i want to withdraw my thanks - no of course not! I notice anothe one earlier but a bit loathe to touch it in case it gives misleading info!

Thanks for your help which I DO appreciate each time,

Could do with a reply as soon as poss cos been struggling with EEprom increments and text thing all day

Cheers, Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Alarm - getting started

Post by Benj »

Hello Chris,
Driving me mad is how to increment EEPROM locations with each hex byte over 60 locations as a pseoudo UART replication in slow motion?
Would something like this help.

component macro -> incoming = Receive RS232 Byte

decision -> incoming < 255

yes: Calculation -> eeaddr= (eeaddr + 1) MOD 60
And a simple but vexing question - how do I put general text on the flowchart (not the comments ones)
You can add text to the top of the Flowchart by using the Macro -> Details menu.
And VERY IMPORTANT about THANKING FOR REPLIES...... I clicked the thumbs up sign on your reply and it appears as a thumbs down so I tried to change it and it said do i want to withdraw my thanks - no of course not! I notice anothe one earlier but a bit loathe to touch it in case it gives misleading info!
The thumbs up is to thanks people for their posts. Once you have given the thumbs up the icon changes to a thumbs down incase you change your mind and want to remove the thanks.

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi Ben,

Many thanks for your reply.

Does that mean it is not possible to put text on the graphed background area of the flowchart only by choosing a 'new' macro and putting the comment in its title tab?

Regards,

Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Alarm - getting started

Post by Benj »

Hi Chris,

Yes I'm afraid you cannot place text any old place on the graphed background area. Maybe turning on annotations in the global options would help.

christoph
Flowcode V4 User
Posts: 382
Joined: Tue Nov 01, 2011 4:28 pm
Has thanked: 196 times
Been thanked: 26 times
Contact:

Re: Alarm - getting started

Post by christoph »

Hi Ben,

OK. Thanks for letting me know. Pity though, because it would be quite useful!

Best regards,

Chris :?

Post Reply