PDA

View Full Version : converting programs~



sanguine
- 11th July 2007, 08:45
attached along with this msg is a PIC16F877A program.
It is bio-related program for a hospital.
Brief description
Patient in hospital may suffer from slp walking disorder.
So this program is for an alarm to be raised when the pressure in the shoe increases(when the patient walks, in other words, there is pressure sensor at the shoe sole.)

Can anyone help convert it for use in PIC 18F4520/18F4420?

skimask
- 11th July 2007, 12:22
attached along with this msg is a PIC16F877A program.
It is bio-related program for a hospital.
Brief description
Patient in hospital may suffer from slp walking disorder.
So this program is for an alarm to be raised when the pressure in the shoe increases(when the patient walks, in other words, there is pressure sensor at the shoe sole.)
Can anyone help convert it for use in PIC 18F4520/18F4420?

I'm sure a lot of people could help with that. The program looks very simple.
Questions is...can you answer any of the questions in the other thread about the '442?
AND, how willing are you to try and learn to do the programming yourself vs. somebody else completely rewriting the code for you.

Melanie
- 11th July 2007, 12:46
This assumes that the patient is going to put on shoes or slippers before they sleep-walk. They don't... they go wandering in bare feet...

The best method is for the patient to wear a wrist ID (of the kind they already fit in hospitals) with a proximity alarm tag (similar to the sort they have in stores to prevent you from stealing merchandise). The alarm is sounded as soon as they go through the main door out of their room or hospital ward. This also allows for the patient to get up normally and go to the bathroom without sounding an alarm (nobody sleepwalking as yet has flushed themselves down a toilet!).

sanguine
- 11th July 2007, 14:29
yes ill reply to that previous thread.
And true, of course i'm very fine with learning it all over, converting myself~
but the thing is if i were to convert myself, i at least will need to know what the program is about. You see, we are given this program coded in PIC 16 and all i need to do is to copy paste into the MPLAB, load into the ICD and thn get it running. But since we need to convert the codes due to the availability of PIC 18, i'll need at least someone to help me get started.
I'm not writing a program myself in this case, i'm given a program written by someone else and i really just need someone to tell me what the various codes mean and then try to make appropriate amendments.
not really looking for people to spoon feed me~

skimask
- 11th July 2007, 15:28
not really looking for people to spoon feed me~

Quite frankly, that's exactly what it looks like...
What were you planning on doing this in? assembly? PBP? C?

sanguine
- 11th July 2007, 15:51
ah well...my bad..=X
It's done in MPLAB IDE

skimask
- 11th July 2007, 17:44
ah well...my bad..=X
It's done in MPLAB IDE

There ya go...all converted for an 18F4520 and everything...

Darrel Taylor
- 11th July 2007, 22:47
There ya go...all converted for an 18F4520 and everything...

Really?

So on a 18F4520, PORTA is at address 0x05 ?

.

sanguine
- 12th July 2007, 10:57
the program don't look any difference to me other then the changing the PIC16F877A to PIC 18F4520.

T.T

skimask
- 12th July 2007, 11:55
the program don't look any difference to me other then the changing the PIC16F877A to PIC 18F4520.

T.T

What did you expect? You said you didn't want to be spoon fed information!!!

Look at the program you posted in post #1... Really look at it...
What's in there? A few defines, a bunch of data blocks, a bunch of loops, and a main loop with some calls to the loops and some delays in it.

Again, you don't want to be spoon fed, so that's as far as I'm going...

skimask
- 12th July 2007, 11:56
Really?
So on a 18F4520, PORTA is at address 0x05 ?
.

I know that...but the O/P doesn't want to be spoon fed, so I figured he/she might be able to find that tidbit in the datasheets.

T.Jackson
- 12th July 2007, 12:05
This assumes that the patient is going to put on shoes or slippers before they sleep-walk. They don't... they go wandering in bare feet...

The best method is for the patient to wear a wrist ID (of the kind they already fit in hospitals) with a proximity alarm tag (similar to the sort they have in stores to prevent you from stealing merchandise). The alarm is sounded as soon as they go through the main door out of their room or hospital ward. This also allows for the patient to get up normally and go to the bathroom without sounding an alarm (nobody sleepwalking as yet has flushed themselves down a toilet!).

Too true. An RFID wrist tag is common place in many nursing homes and hospitals to aid with wandering residents, sadly some with Alzheimer's. In my last job I was employed as a field / bench technician to install and service a wireless nurse call system operating on 27 and 304MHz. Top system. I worked with RFID-based wrist tags, door alarms, pressure sensors, displays, repeaters, dialers. Depressing job.

sanguine
- 12th July 2007, 14:34
I know that...but the O/P doesn't want to be spoon fed, so I figured he/she might be able to find that tidbit in the datasheets.

yea...i DUN want to be spoon fed but that much of information i manage to think of myself. By the way, I'm learning to use a pic16F877 now since my lecturer got me one. Learning the MPLAB IDE ver 7.50.
AND SKIMASK.. im a 18 yr girl who is an extreme noob in programming.
I'm only taught for 1-3 month for my MCT module?
I dun think i can be as pro as you are...if not i would'nt have asked for help here! if that is spoon feeding to you then be it. I'm very fine with it.

skimask
- 12th July 2007, 14:42
yea...i DUN want to be spoon fed but that much of information i manage to think of myself. By the way, I'm learning to use a pic16F877 now since my lecturer got me one.
Which is a fair distance from a PIC18F442/452...


Learning the MPLAB IDE ver 7.50.
Also outdated, latest version is 7.61 (maybe 7.62 by now)


im a 18 yr girl
Don't matter...


who is an extreme noob in programming.
Then pick up an 'extreme noob' type project and work your way up.


I dun think i can be as pro as you are...
Time will tell now won't it...


if not i would'nt have asked for help here! if that is spoon feeding to you then be it. I'm very fine with it.
Good, because I haven't seen anything that you have written yet...just copies of stuff you want converted.
Show us something that YOU have written, and when it doesn't work, ask the question Why...

sanguine
- 12th July 2007, 15:57
oh..i would not have choose such a difficult proj (but i noob) if i have a choice..
I was GIVEN it.
and ya...i'll try to learn and if there is still qn I'll ask WHY.
n for ur information, i tell u im a girl so u dun have to say he/she.
geezz..

skimask
- 12th July 2007, 16:05
oh..i would not have choose such a difficult proj (but i noob) if i have a choice..
I was GIVEN it.
and ya...i'll try to learn and if there is still qn I'll ask WHY.
n for ur information, i tell u im a girl so u dun have to say he/she.
geezz..

You were GIVEN this? As a first project or what?
Elaborate a bit on what the code is supposed to accomplish...I know you said it's for sleeping walking/pressure sensor/whatever...
What does the circuit this is connected to look like?

sanguine
- 12th July 2007, 16:23
YES!!
oh my..do u thing I'm so crazy as to start of learning mct by trying to convert other people program? That will be like learning to run before i know how to walk.
this is my first project in mct..it's also my final year project!
u want the proj brief? hah..i'll tell u.

some patients do slp walk
so this particular hospital wants us to make the sole of the shoe with sensors.
Once the pressure increases by the walking patient, the buzzer will sound.
This is what the program does, it processes the reading then decide if it wants to raise an alarm..

I don't have any "look like" picture for you

skimask
- 12th July 2007, 16:28
YES!! oh my..do u thing I'm so crazy as to start of learning mct by trying to convert other people program? That will be like learning to run before i know how to walk. this is my first project in mct
MCT = ???


..it's also my final year project!
I hope you didn't pay good money for that course... How many years do you have to go thru to get to a 'final year' anyways?


some patients do slp walk... so this particular hospital wants us to make the sole of the shoe with sensors. Once the pressure increases by the walking patient, the buzzer will sound. This is what the program does, it processes the reading then decide if it wants to raise an alarm..
You mean just like you wrote in post #1?
So far, all you've done is describe what you want the end result will be.
What kind of sensors do you plan on using? How do you plan on reading those sensors?
Ok, you'll use a PIC16F877A... Are you planning on using straight assembly in MPLAB IDE to program this?
What do you know about programming in general? Assembly? PICs? Electronics?

sanguine
- 12th July 2007, 16:36
MCT = ???
microcontroller technology


I hope you didn't pay good money for that course... How many years do you have to go thru to get to a 'final year' anyways?
lots of money...have you heard of POLYTECHNICS IN SINGAPORE?
yea..im in one of them. 3 yrs course, but they teach u different modules regarding ur course. graduation ends with exam n a final year project.



You mean just like you wrote in post #1?
So far, all you've done is describe what you want the end result will be.
What kind of sensors do you plan on using? How do you plan on reading those sensors?
Ok, you'll use a PIC16F877A... Are you planning on using straight assembly in MPLAB IDE to program this?
What do you know about programming in general? Assembly? PICs? Electronics?

yes...i meant that. The sensor part will be briefed by the lecturer in the later part. We have to get the program working first! yea..i thought of using MPLAB because im ONLY taught that and moreover the syllabus only requires us to learn PIC18F452 and basic programming like displaying msg on LCD screen. they DON"Y teach us anything else..other PICs or what..nothing

skimask
- 12th July 2007, 16:52
lots of money...have you heard of POLYTECHNICS IN SINGAPORE?
Should I have?

Sounds to me like you should first learn how to make the standard 'blinky LED' type project and work your way up to your 'final project'.

mister_e
- 12th July 2007, 19:00
What Skimask mean between the line (or colon), is that YES we can help you, but you'll need to tell us a little bit more about what you already find/tested. Sensor, , additional hardware, links, datasheet, method etc etc.

skimask
- 12th July 2007, 19:08
What Skimask mean between the line (or colon), is that YES we can help you, but you'll need to tell us a little bit more about what you already find/tested. Sensor, , additional hardware, links, datasheet, method etc etc.

Yep...what him said...
(colon.........Oh you're a riot nowadays!!! :D )

BobK
- 12th July 2007, 23:30
Hi sanquine,

I replied earlier this morning about the same thing that Melanie did but for some reason it didn't get posted.

Stop for a minute and re-read what you have posted here. You want to know when a sleep walker gets up and starts walking around. You are wanting to put sensors on the patients shoes or slippers. Like Melanie stated, most sleep walkers just get up and start walking. I think you are over complicating things here.

I think all you need are a couple of pressure mats placed on each side of the bed connected to a simple sounder circuit or even something like a 555 timer. You could even put an opening sensor on the door into the patient's room with a pressure pad inside the door and using a 555 timer, when the patient steps on the mat it enables the 555 timer to operate as soon as the door is opened. This configuration would not sound if the door is opened first such as when the nurse comes in to check on the patient. If you are hell bent on using a PIC then something like the 12F chips could be used instead of the 555 timer. Yea I remember from one of your posts that you need to use a 18F452 but they gave you an 16F877A. Well you can use that in place of the 555 or 12F PIC. Fancy up the project once you have the basics working by adding flashing lights outside the patient' s room or have a LCD display with alerting beeper at the nurse's station display something like "Mr Smith is sleep walking again!"

What you are asking for or being asked to do isn't difficult to do, but to put sensors on a patient's shoes is a big waste of time.

I have in the past two years provided numerous solutions for my biggest security client. The last project was for unassisted apartment dwellers on this retirement campus that are in the beginning stages of dementia but not quite ready for the full assistance package. The apartments already have alarm dialers for the emergency cords and smoke detectors. We put together a PIC controlled clock that enables a wireless door transmitter between 10pm and 7am. If the person leaves during these hours, then security personnel go and check on them. While one person is responding, another person is monitoring the 4 main exits on the video system to see if they leave the building before help arrives. The PIC controlled clock is not affected by the spring and fall time change and needs a new backup battery every 5 years. Works great and all we need the patient to do is walk out the door. No shoes? No problem.

Take your project in small steps then build it up to the grand finale!

Sure hope this helps you in some way.

By the way, I noticed that you wanted to do your project in assembly. This forum is for people using PICBasic and PICBasic Pro. You might want to look over the software most of us use here and switch to this because your developement time will be alot shorter.

Good luck!

BobK

Melanie
- 13th July 2007, 07:54
I think in some instances students are given a task by a lecturer and are expected to run with the assigned project (whether it's a good idea or not is irrelevant). The lecturer is looking to see how each student will cope with the assignment.

sanguine
- 13th July 2007, 13:04
THX BOB~
=)
yea..i know...would not want to have complicated things but its just that, as melanie said, its an assignment given to us. The teacher does not expect us to tell him there might be another better choice in this or that way.
He just want us to do what he ask for and give us the grades.
Anyway, i'm trying~
And i'm really thankful for the concern and suggestion that i've received!

T.Jackson
- 13th July 2007, 14:29
As my grandfather always said to me; don't do as I do - do as I bloody say.

RussMartin
- 14th July 2007, 05:39
I think in some instances students are given a task by a lecturer and are expected to run with the assigned project (whether it's a good idea or not is irrelevant). The lecturer is looking to see how each student will cope with the assignment.

I think Melanie has correctly assessed the situation; I'm sorry that skimask wasn't a little gentler.

A young friend of mine (he's about 35 now) went to a private (expensive) tech school about 10 or 12 years ago. In one class they were divided into teams and each team was challenged, in addition to regular course work, to design and specify a portable scoreboard for Pop Warner football ("American football"; Pop Warner is the football equivalent to Little League baseball). At the time of the assignment, no student had any experience in specification, nor in microprocessors. They had learned basic digital, discrete analog, and op amps. As Melanie said, they had to "run with it". Anyway, his team needed a simple, reliable clock signal source, so he called me for ideas. I showed them how to do it with a couple of buffer gates and a crystal. (The teacher told them it wouldn't work. I breadboarded it and brought it to his class. Yes, it worked--just not a circuit you find in the textbooks!)

Sanguine, just keep at it. Don't let the naysayers get you down. We were all once newbies!

sanguine
- 14th July 2007, 12:41
oh..thank you RussMartin..
I'm alright with skimask actually, its just that i was quite unused to the way he say things. I just felt like he wasn't trying to understand my situation.
I really would have prefered things where i get to start at more basic things.
But anyway, i'm still browsing through the net n see if i can more information regarding my project. I have met many helpful people so far and its kind of more encouraging.
i'll work harder~