Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,188 members, 7,811,481 topics. Date: Sunday, 28 April 2024 at 12:44 PM

Microcontrollers - Programming (7) - Nairaland

Nairaland Forum / Science/Technology / Programming / Microcontrollers (34276 Views)

Help Needed On My Project Work Using Microcontrollers / How To Write Assembly Language For Microcontrollers (2) (3) (4)

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) ... (14) (Reply) (Go Down)

Re: Microcontrollers by princejude(m): 7:39pm On Jun 27, 2013
If you have a PIC development kit : Connect the serial port connector (DB9) of your kit to the USB port of your Laptop through your USB-to -serial converter.

If you don't have a kit : construct the RS232 to TTL conversion circuit I posted earlier (yellow color) on a vero or project board with a PIC16F887 chip.

Then create a project as show below:
Re: Microcontrollers by princejude(m): 8:22pm On Jun 27, 2013
Create a new folder for each project, open the ccs pic c software.



Click Project >> PIC Wizard. Then select your project folder.Type serial_test in your file name Click save to open next window.
Re: Microcontrollers by princejude(m): 9:01pm On Jun 27, 2013


In device select PIC16F887, In Oscillator Frequency type 4,000,000 because we are using 4MHz crystal.

Then change "High Speed Osc" to "Crystal Osc"

Click ok to open the code window as shown below:

Re: Microcontrollers by princejude(m): 9:29pm On Jun 27, 2013
Now this is where the coding will begin.

If you look at the code window, the compiler has already wrote the setup section of the code for you.

You can type your code under the // TODO: USER CODE!! line.

Type this code:


printf("Wellcome to Programming Section \r The best section in Nairaland" ) ;
while(true)
{}


Click Compile >> Build ALL to build or compile the project.

Re: Microcontrollers by princejude(m): 9:37pm On Jun 27, 2013
The above line of code will send the string


"Wellcome to Programming section
The best section in Nairaland"

to your serial port

"\r" is a carage return which will make the printing to start from next line
Re: Microcontrollers by Nobody: 6:08pm On Jun 28, 2013
That is cool!
@princejude, please im doing a project that uses reed switches. Please do you know if I culd get a small magnet that culd switch the reed switch from Microscale?
Re: Microcontrollers by princejude(m): 3:31pm On Jun 29, 2013
Have you tried it with any magnet? What it need is just magnetic field. We have the reed switch. I don't think it came with any special magnet
Re: Microcontrollers by Nobody: 5:25pm On Jun 29, 2013
princejude: Have you tried it with any magnet? What it need is just magnetic field. We have the reed switch. I don't think it came with any special magnet
its ok, I kno it can work wit any magnet but i just want a small custom made magnet dat can fit in a small place.
I may have to cut one for myself grin
Re: Microcontrollers by Tchalz(m): 1:25pm On Jul 02, 2013
I am s0 grateful guys,PRINCE JUDE,HOFFMAN,N HOLAX.Finally I get t0 meet micr0c0ntr0ller guys.I stay in Calabar and can't find this usb(pickit2) MC programmer.The
0nly I kn0w 0f is in the habit 0f h0arding kn0wledge.I need help 0n h0w t0 get it.Thanks guys! M s0 grateful t0 y0u guys f0r this thread
Re: Microcontrollers by princejude(m): 2:40pm On Jul 02, 2013
Tchalz: ...can't find this usb(pickit2) MC programmer.The
0nly I kn0w 0f is in the habit 0f h0arding kn0wledge.I need help 0n h0w t0 get it.Thanks guys! M s0 grateful t0 y0u guys f0r this thread
Re: Microcontrollers by princejude(m): 2:45pm On Jul 02, 2013
Tchalz: ...can't find this usb(pickit2) MC programmer.The
0nly I kn0w 0f is in the habit 0f h0arding kn0wledge.I need help 0n h0w t0 get it.Thanks guys! M s0 grateful t0 y0u guys f0r this thread

You can get pickit2 and pickit3 from Microscale Embedded Ltd (in Kaduna)

Pickit2 N5,500
Pickit3 N7,000

Both are usb-based programmers that can program most PIC chips

If you want them to send it to you through public transports add N2000 for shipment. Note that the N2000 will be for all the material you buy from them. So to make the shipment cheaper, it is better to buy as many tools and components as you can.
Re: Microcontrollers by Tchalz(m): 3:53pm On Jul 02, 2013
Thanks Prince f0r tha c0rrecti0n..Pls give me the list of all tha t00ls n kits I need s0 dat I can 0rder them all at 0nce..
Re: Microcontrollers by princejude(m): 5:04pm On Jul 02, 2013
Tchalz: ...Pls give me the list of all tha t00ls n kits I need s0 dat I can 0rder them all at 0nce..

I have done that earlier. Check page 4 of this thread.
Re: Microcontrollers by Tchalz(m): 8:43pm On Jul 02, 2013
Thanks br0.My email is ekpeeffiong@gmail.com.Wud appreciate it if yu c0uld send me details 0f h0w t0 make this 0rder.
Re: Microcontrollers by princejude(m): 10:08am On Jul 03, 2013
@ Tchalz

Check your mail box.
Re: Microcontrollers by princejude(m): 3:51pm On Jul 03, 2013
Back to topic...

After you have compiled the above code successfully, perform the following task.

1. Program your chip using PICKIT2,PICKIT3 or any PIC programmer you have.
2. Put the programmed chip in the 40-pin ZIF (zero insertion force)socket in your PIC dev. kit.
3. Connect the development kit to your laptop using USB-to-Serial converter.
4. Power up the kit using USB or external power supply.
5. Open the SIOW.exe from your taskbar, select the com port shown in your device manager and select 9600 as your baudrate then click ok.
6. In the Serial Input/Output Monitor, click View >> ASCII to open the black window.



If you didn't see your text display as shown above, then press the reset button in you development kit.
Re: Microcontrollers by princejude(m): 4:37pm On Jul 03, 2013
This is a simple serial(UART)communication test program.

Lets briefly discuss about some UART communication functions:

Printf() or fprintf(): Prints or sends some string to the serial com port(on the specified stream in case of fprintf). Note that the serial com port can be any microcontroller that has serial port or any external peripherals that uses serial(uart) communication such as handset,GSM modem, GPS modem, RF transmitters, RF receivers, RF transceivers,etc.

Putc(), putchar() or fputc() Puts a character over the transmit pin(on the specified stream in the case of fputc).

puts() or fputs() Puts a string over the transmit pin(on specified stream in case of fputs

getc(), getch(), getchar() or fgetc() gets a character on the receive pin(from the specified stream in case of fgetc). Use kbhit() to check if the character is available.

gets() or fgets() gets string on the receive pin(from specified stream in case of fgets).

kbhit() returns true when a character is received in the buffer in case of hardware usart or when the first bit is sent on the receive pin in case of software usart.
Re: Microcontrollers by princejude(m): 7:17am On Jul 04, 2013
USART APPLICATION IN SMS-BASED HOME AUTOMATION

SMS(or GSM)-based home automation is a simple project that helps you to control your house through sms.
That is , your can ON or OFF any of your electrical appliances such as light, fan, Air con., fridge, TV, CD etc using sms.
The project will use a GSM modem with a registered sim card. To ON any appliance, you send a coded sms to the sim card number. The microcontroller communicates to the GSM Modem through USART.
Re: Microcontrollers by Tchalz(m): 9:08am On Jul 04, 2013
PrinceJude pls I haven't received y0ur mail..ekpeeffiong@gmail.com.Tnx
Re: Microcontrollers by princejude(m): 11:09am On Jul 04, 2013
Tchalz: PrinceJude pls I haven't received y0ur mail..ekpeeffiong@gmail.com.Tnx

Check your mail box, i re-sent it
Re: Microcontrollers by Nobody: 1:57pm On Jul 04, 2013
princejude: USART APPLICATION IN SMS-BASED HOME AUTOMATION

SMS(or GSM)-based home automation is a simple project that helps you to control your house through sms.
That is , your can ON or OFF any of your electrical appliances such as light, fan, Air con., fridge, TV, CD etc using sms.
The project will use a GSM modem with a registered sim card. To ON any appliance, you send a coded sms to the sim card number. The microcontroller communicates to the GSM Modem through USART.
Cant wait for the project grin
Re: Microcontrollers by Tchalz(m): 7:46pm On Jul 04, 2013
Thanks so much engr Jude.Cnt wait f0r yu t0 lecture ab0ut scr0ll message display using d0t matrix and PIC
Re: Microcontrollers by princejude(m): 10:02am On Jul 06, 2013
GSM communication with PIC

Gsm modems or phones communicate to microcontrollers using AT commands(ATtention commands) through the serial port.

For more info about sms and AT commands: http://www.developershome.com/sms/atCommandsIntro.asp OR http://www.developershome.com/sms/

Study the above links and please read carefully on how to send sms using AT commands because we will use some of the commands.
Re: Microcontrollers by Nobody: 8:15pm On Jul 06, 2013
OK, Prof Jude, we have reveiwed the specified site grin
Re: Microcontrollers by princejude(m): 2:34pm On Jul 08, 2013
SMS Home Automation Circuit

Re: Microcontrollers by Nobody: 5:56am On Jul 09, 2013
Great, Prof., Engr., Jude grin please d pic is almost unreadable for me! can u please send it in a larger form to my inbox?
Re: Microcontrollers by Nobody: 10:40am On Jul 10, 2013
@princejude, thanks I got the circuit wink
Re: Microcontrollers by princejude(m): 10:48am On Jul 10, 2013
List of Components for this Project


Components Quantity Cost(N)

PIC18F4520 (or PIC16F887) 1 18f4520 = N1200, 16f887 = N700
40-Pin IC Socket 1 N100
11.0592MHz Crystal 1 N100
22pF Capacitor 2 N20 each
10K Resistor 1 N10
Button Switch 1 N20
10uF Capacitor 1 N20
16x2 LCD 1 N1000
2K Resistor 1 N10
Siemens GSM modem (or any) 1 N10,000
1K Resistor 4 N10
BC547 NPN Transistor 4 N30
6V/10A Relay 4 N100
1N4007 Diode 8 N10 each
7805 Regulator 1 N50
1000uF/50V Capacitor 1 N50
12V/500mA Transformer 1 N250


They are available
Re: Microcontrollers by princejude(m): 10:50am On Jul 10, 2013
The Siemens GSM Modem

Re: Microcontrollers by Nobody: 2:20pm On Jul 10, 2013
@princejude, can u give d cost of all d components and will all be available at microscale?
Re: Microcontrollers by Tchalz(m): 9:59am On Jul 11, 2013
Engr pls cud yu post the cost of the modem and PIC MCU for this project as I intend to include them on my list of items.Tnx
Re: Microcontrollers by princejude(m): 11:22am On Jul 11, 2013
Tchalz: Engr pls cud yu post the cost of the modem and PIC MCU for this project as I intend to include them on my list of items.Tnx

The price is in the list of components I posted above.

(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) ... (14) (Reply)

What Is Computer Programming / First Thing First, Learn To Program! / How To Make A Simple Calculator In Notepad Using .bat Format

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 36
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.