PR8-b, need help [Urgent]

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

PR8-b, need help [Urgent]

Postby demonden02 » Sun Nov 14, 2010 1:50 am

basically i never learn this software before, i am totally no idea new to this program because i am from mechanical engineering

due to my FYP required this system, so i have to use this PR8-b...

i have downloaded the example from cytron website (http://www.cytron.com.my/usr_attachment ... 0PR8-B.zip)

briefly explain my project concept
my FYP doing reverse vending machine in other words recycle vending machine.
To encourage ppl to recycle, our machine will give away 2 points when the user recycled their can's. and these 2 points will be storage in their card.

this is what i wanna to set for my PR8-b process
1. detected a object, then LCD screen display "Please scan your card"
-> if after 1min card is not scanned, then LCD display "thank you"
-> else, then 2 point collected for user and LCD display "2 point collected" then after 5second, display "thank you"


just a simple program but i dont know how to use mplab at all
and i need some gentleman to help me....

thanks in adv
demonden02
Greenhorn
 
Posts: 2
Joined: Sun Nov 14, 2010 1:01 am

Re: PR8-b, need help [Urgent]

Postby kl84 » Sun Nov 14, 2010 6:13 pm

If you have no idea what to do, i'll suggest you to look at the few diy project sets provided by cytron. If not mistaken, PR1 has the full instruction guiding you on MPLAB IDE.
User avatar
kl84
Amateur
 
Posts: 166
Joined: Thu Jul 08, 2010 12:14 pm

Re: PR8-b, need help [Urgent]

Postby shahrul » Sun Nov 14, 2010 8:13 pm

Try to view step2 MPLab here and I have another RFID example.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: PR8-b, need help [Urgent]

Postby yonghui » Sun Nov 14, 2010 8:45 pm

hi,

basically u will need to know how to write simple C language. start by opening the existing project so that u wont need to setup all the things in the compiler. try to do simple LED blinking. read the datasheet of PIC. to know how to initialize it. try to write LED blinking. if sucessful, then congrates. u can move on. LCD just need to call library provided by the DIY projects of cytron. happy trying!



rgds,
yh
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: PR8-b, need help [Urgent]

Postby ober » Sun Nov 14, 2010 9:39 pm

Agreed with yonghui, if microcontroller is used, you will need to learn how to use it. Is like driving motorcycle or car, if you need to drive it, you will need to learn it.

compile the sample source code provided under the DIY project. You should able to do it if you follow the steps carefully. Many did it :D , so be confident in yourself as you can do it!

Your project will need some modifications. Yes, if you know how to do it, it will take 30 minutes or less, but if don know how to use it, 2 weeks you are going no where. :)
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: PR8-b, need help [Urgent]

Postby demonden02 » Sun Nov 14, 2010 10:50 pm

i have basic c++ knowledge, as what i know, C language and C++ language is similar...
so i think this C language should be no problem...
but about the datasheet, really make my head BIG!!
1st time read this electronic drawing so serious...><!!

shahrul WROTE:Try to view step2 MPLab here and I have another RFID example.


void pic_init(){
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;
ADCON1=0b00000110; //configures the functions of the port pins
PORTA=0b00000000;
PORTB=0b00000000;
PORTC=0b00000000;
PORTD=0b00000000;
PORTE=0b00000000;}

i dont understand this....

To: ober
i dont hv so much time to learn><!!!
my case is not learning driving, is diving...
i dont wan my ship diving into sea (i mean my final year mati)... unless with u guys help/support me to transform my ship become submarine ^^

btw, thank to u all guys!!!
demonden02
Greenhorn
 
Posts: 2
Joined: Sun Nov 14, 2010 1:01 am

Re: PR8-b, need help [Urgent]

Postby shahrul » Mon Nov 15, 2010 12:36 am

demonden02 WROTE:void pic_init(){
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;
ADCON1=0b00000110; //configures the functions of the port pins
PORTA=0b00000000;
PORTB=0b00000000;
PORTC=0b00000000;
PORTD=0b00000000;
PORTE=0b00000000;}

i dont understand this....

see this
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: PR8-b, need help [Urgent]

Postby kl84 » Mon Nov 15, 2010 1:02 am

You need to look at the I/O Ports section in the PIC datasheet.
TRIS refers to data direction register (as input or output). It determines the direction of the corresponding PORT. Eg: TRISA set the data direction of PORTA.

demonden02 WROTE:TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;

These mean set all the 5 i/o ports (A,B,C,D,E) as output because the values are all '0'.
Easiest way to remember: '0' = Output, '1' = Input. So if you want a certain pin as input, just write '1' at the corresponding bit. Eg: if you wan to set RB0 and RB1 as input and other pins as output, you write TRISB = 0b00000011;

demonden02 WROTE:PORTA=0b00000000;
PORTB=0b00000000;
PORTC=0b00000000;
PORTD=0b00000000;
PORTE=0b00000000;

Since all ports are output, this part of program makes these ports output '0' (LOW). If you want any pin to output '1' (HIGH or 5V), just write '1' at the corresponding bit.

demonden02 WROTE:ADCON1=0b00000110;

This one is more complicated. You must refer to the datasheet. It sets up the ADC module. In the datasheet, the 4 least significant bits in ADCON1 register determine whether the pins labeled 'AN_' are digital i/o or analog channel.

:!:
Basically, whenever you want to use a function or setup a module in the microcontroller, you need to refer to its section in the datasheet. You need to read everything in that section in order to get things right. It'll tell you what are those registers associate with the module you want to use. Then you must set the register properly so that the module works in the way you want and gives you the correct result.
User avatar
kl84
Amateur
 
Posts: 166
Joined: Thu Jul 08, 2010 12:14 pm

Re: PR8-b, need help [Urgent]

Postby robosang » Mon Nov 15, 2010 10:18 pm

Yes, agreed, you will need to understand the program in-order to modify it. That's the fun part, that's learning.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PR8-b, need help [Urgent]

Postby Noobie » Thu Nov 25, 2010 1:19 am

Guys any on9 notes source of what u guys just explained ?

what about something like this:

send_cmd(0x2E,0x00,0x10,0x00);


what is 0x2E? are they address or?
how do we noe what 0X2E do ?
User avatar
Noobie
Freshie
 
Posts: 7
Joined: Mon Nov 08, 2010 5:56 pm

Next

Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 14 guests

cron