₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,346,238 members, 8,521,911 topics. Date: Friday, 20 November 2026 at 09:19 AM

Toggle theme

Princejude's Posts

Nairaland Forum › Princejude's Profile › Princejude's Posts

1 2 3 4 5 6 7 8 ... 13 14 15 16 17 18 19 20 (of 20 pages)

Programming › Re: Microcontrollers by princejude(m): 7:28am On Jun 23, 2013
hopefullman: Thanks.what of the usb comunication.is it different to that of rs232
USB communication is diferent from serial or rs232 comminication.
Right now we are on serial not usb. Usb may come later.
Programming › Re: Microcontrollers by princejude(m):
I2C

The inter-integrated circuit (I2C) bus is designed for short-range communication between chips in the same system using a software addressing system. It requires only two signal wires and operates like a simplified local area network.
The I2C slave chips are attached to a two-wire bus, which is pulled up to logic 1 when idle. Passive slave devices have their register or location addresses determined by a combination of external input address code pins and fixed internal decoding. If several memory devices are connected to the bus, they can be mapped into a continuous address space. The master sends data in 8-bit blocks, with a synchronous clock pulse alongside each bit. As for SPI, the clock is derived from the instruction clock, up to 5 MHz at the maximum clock rate of 20 MHz.

To send a data byte, the master first sends a control code to set up the transfer, then the
8-bit or 10-bit address code, and finally the data. Each byte has a start and acknowledge bit, and each byte must be acknowledged before the next is sent, to improve reliability.

https://img163.imageshack.us/img163/8949/7mx.png

I2C Connection
Programming › Re: Microcontrollers by princejude(m):
SPI

The serial peripheral interface (SPI) bus provides high-speed synchronous data exchange over relatively short distances (typically within a set of connected boards), using
a master/slave system with hardware slave selection. One processor must act as a master, generating the clock. Others act as slaves, using the master clock for timing the data send and receive. The slaves can be other microcontrollers or peripherals with an SPI interface. The SPI signals are

Serial Clock (SCK)

Serial Data In (SDI)

Serial Data Out (SDO)

Slave Select (!SS)


To transfer data, the master selects a slave device to talk to, by taking its SS line low. Eight data bits are then clocked in or out of the slave SPI shift register to or from the master. No start and stop bits are necessary, and it is much faster than RS232. The clock signal runs at the same speed as the master instruction clock, that is, 5MHz when the chip is running at the maximum 20 MHz (16 series MCUs).

https://img689.imageshack.us/img689/8162/7st.png

SPI Connection
Programming › Re: Microcontrollers by princejude(m):
LESSON 7: Serial Communication

Serial data connections are useful because only one or two signal wires are needed, compared with at least eight data lines for a parallel bus plus control signals. The typical PIC microcontroller offers a choice of serial interfaces. The best one for any given communication channel depends on the distance between nodes, the speed, and the number of hardware connections required.

Types of Serial Communication

USART
SPI
12C

USART

The universal synchronous/asynchronous receive transmit (USART) device is typically used in asynchronous mode to implement off-board, one-to-one connections. The term asynchronous means no separate clock signal is needed to time the data reception, so only a data send, data receive, and ground wires are needed. It is quick and simple to implement if a limited data bandwidth is acceptable.

A common application is connecting the PIC chip to a host PC for uploading data acquired by the MCU subsystem. The USART link can send data up to 100 meters by converting the signal to higher-voltage levels (typically 12V). The digital signal is inverted and shifted to become bipolar (symmetrical about 0V, line negative when inactive) for transmission.

The PIC 16F887 has a dedicated hardware RS232 port, but CCS C allows any pin to be set up as an RS232 port, providing functions to generate the signals in software. The basic form of the signal has 8 data bits and a stop and start bit. The bit period is set by the baud rate. A typical value is 9600 baud, which is about 10k bits per second. The bit period is then about 100μs, about 1 byte per millisecond, or 1K byte per second.

The data are transferred between shift registers operating at the same bit rate; the receiver has to be initialized to the same baud setting as the transmitter. Assuming we are looking at TTL level data, in the idle state, the line is high. When it goes low, the receiver clock is started, the data are sampled in the middle of each following data bit period, and data are shifted into the receive register

https://img545.imageshack.us/img545/9760/e7ee.png

USART Operation
Programming › Re: Microcontrollers by princejude(m): 9:30am On Jun 21, 2013
I added the "org 00" line to your code and it compiled successfully. Note the org statement is used to initialize the code. Always include it in all your asm code.


list P = 16F84
STATUS equ 03h
TRISA equ 85h
PORTA equ 05h
COUNT1 equ 08h
COUNT2 equ 09h

org 00 ; sets the origin, the program starts running here.///// Very important ////

bsf STATUS, 5
movlw 00h
movwf TRISA
bcf STATUS, 5

Start movlw 02h
movwf PORTA

Loop1 decfsz COUNT1, 1
goto Loop1
decfsz COUNT2, 1
goto Loop1

movlw 00h
movwf PORTA

Loop2 decfsz COUNT1, 1
goto Loop2
decfsz COUNT2, 1
goto Loop2

goto Start

end
Programming › Re: Microcontrollers by princejude(m): 10:06pm On Jun 20, 2013
@ CogitoErgo

That is not a complete code. Post your complete code so that we may help you to debug it and I also want to tell you that I don't use asm frequently. The last project I did with asm is up to a year now. Why do you prefer asm? You can try this nice electronics site http://www.talkingelectronics.com/te_interactive_index.html They used asm in their PIC sections. Just scroll down the site to the PIC sections...
Programming › Re: Microcontrollers by princejude(m): 5:33pm On Jun 20, 2013
bosunsky: pls, can u send me the list of all the basic tools i need, that can get me started, i'm very sorry i ask cos av not been following this thread b4.
pls send the list and phone no. to my mail :: abodunrin5@gmail.com...... i will be happy to see ur response thanks sir!!!!!!!!!smiley
It all depends on the type of microcontroller you want to learn with such as PIC, 8051 or AVR.
You will need the development kit and the programmer



For PIC microcontroller you will use any of this options:

Option one:
PIC development kit with built-in programmer and PIC16f887
including all the software and sample codes = N15,000 + N2000 shipment

Option two:
PIC development kit with PIC16f887
including all the software and sample codes = N10,000
PICKit2 programmer (cloned) = N5,500 + shipment = N2,000

Option three:
PIC development kit with PIC16f887
including all the software and sample codes = N10,000
PICkit3 Programmer = N7,000 + Shipment = N2000

For 8051 you will need :
8051 development kit with built-in programmer and AT89c51 or STC89c51 chip
including all the software and sample codes = N15,000 + shipment = N2000

For AVR you will need :
AVR development kit with ATmega16
including all the software and sample codes = N10,000
AVR ICSP Programmer = N7000 + shipment = N2000

Programming › Re: Microcontrollers by princejude(m): 2:50pm On Jun 20, 2013
bosunsky: Where in ibadan can i get all the tools needed to start dis microcontroller program, av been waiting for this all long!!!!!!
Send the list of the tools you need to microscale embedded(or you can post the list on this thread) and pay into their account( add N2000 for shipment), then they will send your tools in less than 48 hours after they have confirm your payment.
Programming › Re: Microcontrollers by princejude(m): 11:09am On Jun 17, 2013
[quote author=Java_Prince] Mahn I will have to think over it. I really would love to be bulding robotic machines with my object oriented mindset. [color=#000000] [font=Lucida Sans Unicode][/font][/color][/quote]May be you can try using Arduino with AVR microcontroller http://arduino.cc/en/Tutorial/HomePage. It looks like object oriented I have not use it before and you have to check where and how to get the Arduino development kit. If you want to switch to the normal embedded c,you can start from downloading the ebooks I have uploaded in this thread.
Programming › Re: Microcontrollers by princejude(m): 10:46am On Jun 17, 2013
hopefullman: @prince jude.pls hw can i get the pickit3 programer?my location is akure?dnt mail me 2ru nl cos dmail is dormant.my working mail is truetalk360@yahoo.com.thank u
I have sent you a mail. Once we confirm your payment you will get your parcel in the next 24 to 48 hrs
Programming › Re: Microcontrollers by princejude(m): 8:12pm On Jun 16, 2013
[quote author=Java_Prince] Are you trying to say that only projects that has to programmed in java is such that must be controlled with GUI ...?[/quote]Yes we did one using c#. I don't know if there is any other way to use java with mcu. May be u can ask mr. google
Programming › Re: Microcontrollers by princejude(m): 4:00am On Jun 16, 2013
[quote author=Java_Prince] But my mentor has told me that java can also be used in the programming of microcontrolers.[/quote]You can use java or c# in microcontroller projects to design GUI(graphical user interface) if your project need to be controlled from a PC . Note that the java or c# is only used on the PC based GUI which will be interfaced to the microcontroller through serial comunication. The microcontroller must have its code written in another language such as c or asm
Tech Jobs › Re: I Need A Smart Card Reader/writer For Biometric ID Card System(urgent) by princejude(m): 1:51am On Jun 12, 2013
Smart card or electronic id card is still part of embedded system. Contact them and tell them what you want. I think they can help you in components sourcing,programming and building of the system. Open there facebook page

www.facebook.com/microscale

then scroll down, you will see one biometric attendance system as one of their product.
Tech Jobs › Re: I Need A Smart Card Reader/writer For Biometric ID Card System(urgent) by princejude(m): 3:32pm On Jun 11, 2013
Have you try Microscale at www.microscale-embedded.com ?
Programming › Re: What Are The Cost implications Of Creating A Customised Operating System? by princejude(m): 6:19pm On Jun 09, 2013
Otuabaroku: Instead of that ,why not look at accomplishing your task using embedded system. You can easily achieve this using FPGA.The advantage of using embedded system is its speed and cost.
@ Otu... Have you use FPGA ?
Politics › Re: Bomb Blast Averted In Kaduna by princejude(m): 2:04pm On Jun 08, 2013
Programming › Re: Microcontrollers by princejude(m): 4:15pm On Jun 07, 2013
Good Boi: I am currently learning C++ and am interested in microcontrollers and embedded system, I want to know if C++ is sufficient for microcontroller programming, as in without c
If you have any C++ compiler that can convert your C++ code to HEX file then you can use it for microcontrollers.

I have not seen such compiler. Note that C++ and C are very similar, so if you know how to code with C++ you can easily switch to embedded C. Download the ebooks I have uploaded in this thread and study them and you will see their similarities. Also search for other microcontroller based ebooks that will help you to learn C.
Programming › Re: Microcontrollers by princejude(m): 2:24am On Jun 06, 2013
hopefullman: @princejude What's d diff btwn pickit2 & pickit3.thank u
Pickit3 is the elder brother to Pickit2. It is the latest programmer from microchip. The major difference is that PICkit3 can program most of the current PICs and dsPICs while PICkit2 may not program all the current PICs and dsPICs.
Programming › CNC Programming by princejude(op): 3:25am On May 27, 2013
Please do we have cnc programmers in the house? I will like us to share some ideas so that we can learn from others. I am new in CNC programming but from my little research it seems like it will help in PCB fabrication. I have been into PCB design for years but we always do the fabrication overseas. I will like to start the automated fabrication in Nigeria. I have been searching on where and how to buy a cnc machine. The most positive result I have found is proxxon mf70 milling machine plus cnc conversion kit. If you can combine the two,then you are on the right path. I have found where to buy mf70 (around 95k) in Lagos but I have not seen the cnc conversion kit. Pls has anyone use the mf70 and conversion kit? I have started reading about cnc g-code.

Note: CNC machine means Computer Numerical Control Machine.
Programming › Re: C Code Help: How Do I Go About This? (pointer To Pointer) by princejude(m): 3:08pm On May 19, 2013
Which compiler are you using ?
It is also better to post a complete, compileable and simple code.
Programming › Re: Microcontrollers by princejude(m): 1:53pm On May 19, 2013
cogitoErgo: The development board I have(from microscale) can only work with 18, 28 and 40 pin PICs
How did you get their kit ?
Did you go to their office or you buy it online (and they send it to you).
If it was online,how many days did it take you to get the kit after payment?
And where is your location (State).
Programming › Re: Microcontrollers by princejude(m): 1:41pm On May 19, 2013
From the CD, open the PICKIT2 USER MANUAL, turn to page 27 to see the circuit below:

https://i44.tinypic.com/2up74t1.png

Wire the circuit in your bread board connect your programmer and you are good to go.






[s]Or you can buy their new dev. kit. It has the 8-PIN chip socket[/s]
Programming › Re: Microcontrollers by princejude(m): 1:11pm On May 17, 2013
cogitoErgo: Thanks a lot. Yea, I have the CCS manual, I will check it again. Thanks
There is this pin connector, like the one used to connect the 16x2 LCD to the dev. board, I want to buy it (the pin plug and its socket) but I dont know its name. Please what is it called? so I will kno what to ask for.
It is called SIL Header (ie. Single-In-Line Header Connector)

The one with pins is the male while
The one with holes is female
Programming › Re: Microcontrollers by princejude(m): 9:51pm On May 16, 2013
cogitoErgo: @princejude, assuming i want multiple analog inputs, can i do this?

setup_adc_ports(sAN0, sAN1)

or
setup_adc_ports(sAN0_sAN1)
No it won't work like that, do is this way:

setup_adc_ports(sAN0|sAN1);


and corresponding channels

set_adc_channels(0, 1)

or
set_adc_channels(0_1)
No, you set each channel individually as shown below:

set_adc_channel(0); 

or
set_adc_channel(1); 


Have you download the CCS manual I posted the link earlier. If yes read the ADC section.

Alternatively, you can also do the adc setups from the pic wizard.
Programming › Re: Microcontrollers by princejude(m): 4:55pm On May 16, 2013
cogitoErgo: Ha, which one be Proteus? I saw everytng except dat Proteus! some of d examples will nid aditional pats and I also want to build external power source fo the the breadboard which will b adapted fo final package later.
microscale said the #15000/15500 starter pack has lcd graphics display(not 16x2) but i did not see it in my package! i taught maybe its bcause i paid 15000naira!
Proteus is a simulator that can be used to simulate your code without any hardware or kit(ok maybe it was not suppose to be included in your pack because you can use your kit to test your codes).

The 128x64 Graphic LCD was not included (optional)because of its cost(around N4000).So if your really want to use it, you can buy one and fix it on its connector in your development kit. Sorry we are just trying to reduce the price of the kits so that it can be affordable for students. Note the N15000 you paid was for both the PIC development kit and the ISCP programmer.
Programming › Re: Microcontrollers by princejude(m): 11:41am On May 16, 2013
cogitoErgo: Thanks. I have already gotten it working! I changed the jumper from W2 to W1 to enable the 7-segment(I did that by trial and error, noting carefully I could spoil things ).
The ICSP programmer is NOT onboard.
Did you see the Pic Development Kit user manual and software (CCS C Compiler, MPLAB, Proteus) in the CD?
If yes, try all the sample codes
Programming › Re: Microcontrollers by princejude(m): 6:49am On May 16, 2013
cogitoErgo: Im using the PIC dev. kit I got from microscale-embedded!
Which of the kits ? The one with on-board ISP programmer or the one without ?

The kits have a user manual that explains how to use them in a CD with some sample codes. Study the manual, there is a jumper used to enable the 7-segment and other peripherals. Maybe you only enabled the LEDs. Note that the LEDs and 7-segments are connected on the same port.
Programming › Re: Microcontrollers by princejude(m): 2:38am On May 16, 2013
cogitoErgo: @princejude, I tried example 5 but instead of the 7-segment to come on, it was the led that was flashing!
Are you testing it with a development kit or with a soldered(vero)board? If you are using dev. kit can you post the link to the kit. We will like to know about your hardware.
Programming › Re: Microcontrollers by princejude(m): 2:31am On May 16, 2013
cogitoErgo: @princejude or anybody, please how many times can I erase and re-write PIC16f887? Please do not refer me to the datasheet, just give me the answer here! Thanks
You can erase and re-write more than a million times
Programming › Re: Microcontrollers by princejude(m):
.
Programming › Re: Microcontrollers by princejude(m): 5:04am On May 14, 2013
EXAMPLE 6: 00 - 99 Counter

#include <16f887.h>
#fuses xt, nowdt, noprotect, noput
#use delay (clock = 4000000)

int decode(int digit)
{
int code;
switch(digit)
{
case 0: code = 0x40;break;
case 1: code = 0x79;break;
case 2: code = 0x24;break;
case 3: code = 0x30;break;
case 4: code = 0x19;break;
case 5: code = 0x12;break;
case 6: code = 0x02;break;
case 7: code = 0x78;break;
case 8: code = 0x00;break;
case 9: code = 0x10;break;
}
return code;
}

void main()
{
int i;
int units, tens ;
int Result;
while(TRUE)
{
for (i=0; i<99; i++)
{
tens = i/10;
units= i%10;

output_A(0B11111101);
Result = decode(tens);
output_B(Result);
delay_ms(100);
output_A(0B11111110);
Result = decode(units);
output_B(Result);
delay_ms(100);
}
}
}
Programming › Re: Microcontrollers by princejude(m):
SEVEN SEGMENT DISPLAY
The segments in a 7-segment display are arranged to form a single digit from 0 to F as
shown in the figure below:

https://i39.tinypic.com/280cpf.jpg

Segments are marked with non-capital letters: a, b, c, d, e, f, g and dp, where dp is the
decimal point. The 8 LEDs inside each display can be arranged with a common cathode
or common anode. With a common cathode display, the common cathode must be
connected to the 0V rail and the LEDs are turned on with a logic one. Common anode
displays must have the common anode connected to the +5V rail. The segments are
turned on with a logic zero.

To display these numbers, the following LED segments will be ON
0 = a,b,c,d,e,f
1 = b,c
2 = a,b,d,e,g
3 = a,b,c,d,g
4 = b,c,f,g
5 = a,c,d,f,g
6 = a,c,d,e,f,g
7 = a,b,c
8 = a,b,c,d,e,f,g
9 = a,b,c,f,g

Digit coding for Common Cathode

https://i42.tinypic.com/9sq97p.png

Digit coding for common anode

https://i44.tinypic.com/ieij4o.png

Example 5: 0 to 9 Counter
This sample counts from 0 to 9 on a single digit common anode 7-segment display

 
#include <16f887.h>
#fuses xt, nowdt, noprotect, noput
#use delay (clock = 4000000)

void main()
{
unsigned char i;
unsigned char num[10] = {0x40, 0x79, 0x24, 0x30, 0x19,
0x12, 0x02, 0x78, 0x00, 0x10};

output_low(PIN_A0); // the common cathode terminal was connected to PIN_A0 through a PNP transitor
// to ON the PNP you must send logic zero to its base terminal
while(true) // loop forever
{
for(i=0;i<10;i++) //count from 0 to 9
{
output_B(num[i]); //send the decoded number to portb. Note,segments a to g were connected to portb
delay_ms(300); // wait 300 ms
}
}
}

1 2 3 4 5 6 7 8 ... 13 14 15 16 17 18 19 20 (of 20 pages)