Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

plz neeeeeeeeeeeeed help with pic

Status
Not open for further replies.

eng manar

Newbie level 5
Joined
Nov 19, 2010
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,332
help with pic

i have project with pic
my project is cash unit

take 2 input :
item number through key pad
variabel value through sensor

give 1 output: through lcd
cost = v* unit cost of the item (which already stord in the pic)

i want to use mikrobasic

couldany one help me plz
 
Last edited:

Which PIC are you using? What sensor are you using for the variable value?

btw, Where are you from?

Tahmid.
 

pic 16f84 or 16f778

fixed sensor or potintiometer
 

Hi,
What's the "variable value" you input from the sensor? If it's a potentiometer, you must be needing to use ADC. In that case you can't use 16F84. You can use 16F877 (I'm assuming that what you wrote was due to a typo).
This is what I understood so far:
You need to find the cost of an object. The microcontroller will identify the object by reading the code off the keypad and will consequently retrieve the stored unit price. V is a variable value, ie, it is an indication of the quantity of the object. Am I right?
If this is so, you don't need a pot or ADC. What you should do is sense the value "v" by reading this off the keypad as well. This will make input and adjustments easier.

Hope this helps.
Tahmid.
 

ok
i will explain
e.g:

i have 4 items:
1: unit cost =3$
2:unit cost=2$
3:unit cost=5$
4:unit cost=6$

that should be stord in pic

now ;

the user want 3 unit from item 2
let the(3 unit ) called weight

so the total cost will be :
3*2 (unit cost)=6


the weight should enter from the sensor or potintiometer

the item should enter from keybad

and the total cost should be display on lcd

i need simulation for this project and code by mikrobasic

is it clear now ???


im so sorry that is my first project and need big help
 

Okay,
It won't be very hard, but you need to decide which sensor you'll use for weight. First clarify that, then we can proceed.
 
i think that is ( fixd sensor) or may be use keybad a gain if that will be easier

thank you
 

Hi,
It depends on what you use. If you want this for something that is mesured in quantity like no. of, keypad will be easier.
 

the input should be( weight )
so i think the sensor better i want to use it like a balance or scale quantity
some thing like that
 

Yes, now decide on the appropriate sensor. You need to find one that is available in your area. Then we can proceed.
 
ok
in fact i dont know the type
but i ask someone orund and he tell me that the best one is (fixed sensor) that is its name
its shape like a meter
did you know it ?

it is work the same as potentiometer (variable resistance )
 

I don't know much about weight sensors. If you could post a picture or the part name, maybe that would help. Post the part name or datasheet and it will help us work out how to sense the resistance/voltage derived due to weight.

Tahmid.
 
I am not familiar to mikroC but what you need is somethink like:

Code:
unsigned int LIST_TABLE[4];
LIST_TABLE[0] = 3;
LIST_TABLE[1] = 2;
LIST_TABLE[2] = 5;
LIST_TABLE[3] = 6;

unsigned int index;
unsigned int value;
unsigned long result;

void interrupt()
{
	if(INTCON.RBIF)
	{
		value = getADC();
		index = getIndex();
		result = LIST_TABLE[index]*value;
		LCD_put(result);
		INTCON.RBIF = 0;
	}
}


int main()
{
	ADC_init(); //configure and init ADC here.. i dont know the specific functions.
	LCD_init();	//configure and init LCD here.. i dont know the specific functions.
	IRQ_init();	//configure and init interrupt for PORTB here.. i dont know the specific functions.

	while (1);

}

The interrupt in this case would trigger when the button goes high and low so you can implement some logic do avoid that.

The functions are just protos to guide you.. i never used mikroC...
 

Well the logic should be he same.. but with Basic.. you have to set the interrupt to check the B port state and connect that port to some START button. So when it press START it will read the ADC and the Digital Input, check at the table and display. Finally just clear the interrupt. At the main you have to init ADCs, LCD and Interrupt and create a infinite loop. If you need.. you have to make some math with the ADC value so it can be usable. Cant help you more than that other than making the code ... if you post a code we can help you..
 

in my opinion you need a wieght cell and a level adapter (as it outputs at most 20mV with 10V input) you can search for 'load cell adapter' and of course 'load cell'... so you can read the weight, and choose the product, and calculate the total price.. (kinda nice project!)

but...

let's check something...

if your prices are in USD per Kg (example...)
how much accurate signal would you need?
i think with 100 div/ it's enough (just enough for cents)!
that's less than 8 bits...

so... with a PIC ADC (10 bits) its good enough...

then,

do you need variable prices? so item #1 costs 4.50 now but someday you need to update to 4.75 (example) if so, store the item prices in the pic eeprom...

and of course... please begin the project your self! at least write the general lines of the code... and begin coding... many people is glad to help if you at least write the first lines...
 

Hi,
I'm taking a look at the sensor and will post something once I get the hang of it.

---------- Post added at 15:58 ---------- Previous post was at 15:31 ----------

Hi,
What I don't get is how to plan to use the flex sensor as weight sensor? Wouldn't using load cells or a strain gauge weight sensor make more sense?
However what I understand from your technique (well, atleast the possibility) is that, you have one part of the flex sensor fixed and drop the object through the other end of the flex sensor and then measure the voltage and understand weight. Is that what you intend to do?
For the coding point of view, first you can have the PIC waiting to receive a high/low from a switch which tells it to start. Then, instructions will be given in the LCD to type in the digit code in keypad. The keypad will read the digit/digits and then will wait for signal from weight sensor. Then, it will calculate and get output. For keypad and LCD, just use the functions in mikroBASIC. For storing values, if you assume you will never change unit price, you can store it in FLASH, but you might just store it in EEPROM and leave an option for changing unit price.

Hope this helps.
Tahmid.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top