Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,162,147 members, 7,849,575 topics. Date: Tuesday, 04 June 2024 at 02:32 AM

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)

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(m): 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:



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): 5:10am On May 14, 2013
.
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): 4:42am On May 14, 2013
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:



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



Digit coding for common anode



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
}
}
}

Programming / Re: Microcontrollers by princejude(m): 4:04am On May 14, 2013
Example 4: Moving LEDs

This is another simple LED example that will ON eight LEDs sequentially(one at a time). The LEDs were connected to PORTB


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

void main()
{
int n; //declare n as an integer variable
while(1) // loop forever
{
output_B(0x01 << n); // ON the 1st LED and SHIFT LEFT to the next one
n++; //increase the value of n
if(n>7) //is n greater than 7 ?
n = 0; //if yes, set n equal to zero
delay_ms(400); //wait 400 ms to slow down the speed
}
}


Programming / Re: Microcontrollers by princejude(m): 3:40am On May 14, 2013
Programming / Re: Microcontrollers by princejude(m): 6:29am On May 13, 2013
usisky:

I think d above eqaution is a bit 'SUSPECT'. Given an ADC resolution of 10 bits , an upper and lower input voltage range of 5V and 0V. The equation should b:

Vin(temp)= (((VREFP-VREFM)/1024) *conversion_result*scaling_factor) - VREFM.

where ; VREFP--- positive refrence voltage(5V in dis case).

VREFM--- negative voltage reference(0V in dis case).

conversion result(adc value).

scaling factor(the factor by which u scaled ur input voltage i.e if u scale ur input by 100, den u multiply it by dis factor to obtain correct result).

while ur equation above will give seemingly d correct result, it wil however be off by at least 1LSB(of d ADC resolution). This is because u devided by 1023 intead of 1024. It may not appear to b a problem in such application(temperature sensing). However, when dealing with signals with narrow differential input voltages, dis wil b unacceptable.

welldone for ur input, we want more contribution to this thread, let it not be one man show because am a bit busy with other programming stuffs like FPGA, ARM and PSoC
Programming / Re: Microcontrollers by princejude(m): 3:11pm On May 12, 2013
cogitoErgo: I adjusted VR2 on the development board and that actually calibrated the temperature reading! But please Princejude, how did they get that conversion formular (i.e, temp=5.00*temp_adc*100.00/1023.00)?

That formula was used to convert the ADC value to temperature in degree Celcius

Note that the ADC module was configured to 10 bits (#device ADC=10) 10 bits = 210 = 1024 but you are counting from zero,0 to 1023
Programming / Re: Microcontrollers by princejude(m): 2:34pm On May 12, 2013
cogitoErgo:
I don wait tire fo ur reply

Sorry for late reply, I was busy with office work.

cogitoErgo:
The only problem is that the temperature reading Im getting is obviously wrong, instead of say 38 to 40 deg C, Im getting 199 to 200 deg C!

Check this second line of your code:


#include <16f887.h>
#device ADC=10 /*** If your #device ADC=8 (8 is default value and is for 8 bits)
It will give you wrong values
Change it to #device ADC=10 --- for 10 bits ****/

Programming / Re: Microcontrollers by princejude(m): 10:26pm On May 11, 2013
To transfer your hex file(compiled ccs code)to your MCU, you will need the following:
1. PIC Programmer (i.e, Pickit2 or Pickit3 or ICD2 or any)Note: Pickit2 (cloned) N5500 and Pickit3 N7000
If you are using pickit2 or pikit3, install its software in your PC.
2. PIC Development kit with PI16F887
3. And of course a computer system.

I have explained how to program an MCU in my earlier post in this thread. Check from first page.
Programming / Re: Microcontrollers by princejude(m): 11:45am On May 06, 2013
cogitoErgo:
 setup_adc(ADC_CLOCK_DIV_8);
setup_adc_ports(sAN0);
set_adc_channel(0); //read anal
lcd_init();


the 2nd line declares pin AN0 of d MCU as d analouge input pin[b](i really dnt kno what dat small s is fo!).[/b]


Hello CogitoErgo, Have you installed the CCS C Compiler in your PC? If yes, open the 16f887.h file from the installation location: C/Program Files/PICC/Devices then scroll down to ADC Function setups, you will see the ADC registers definition as shown below:


// Constants used in SETUP_ADC_PORTS() are:
// First argument:
// OR together desired pins
#define sAN0 1 //| A0
#define sAN1 2 //| A1
#define sAN2 4 //| A2
#define sAN3 8 //| A3
#define sAN4 16 //| A5
#define sAN5 32 //| E0
#define sAN6 64 //| E1
#define sAN7 128 //| E2
#define sAN8 0x10000 //| B2
#define sAN9 0x20000 //| B3
#define sAN10 0x40000 //| B1
#define sAN11 0x80000 //| B4
#define sAN12 0x100000 //| B0
#define sAN13 0x200000 //| B5
#define NO_ANALOGS 0 // None
#define ALL_ANALOG 0x1F00FF // A0 A1 A2 A3 A5 E0 E1 E2 B0 B1 B2 B3 B4 B5


thats where the small 's' is from. Note that NOT ALL PIC MCUs use the small 's'.

For example the ADC register definition for 16F877A is below


// Constants used in SETUP_ADC_PORTS() are:
#define NO_ANALOGS 7 // None
#define ALL_ANALOG 0 // A0 A1 A2 A3 A5 E0 E1 E2
#define AN0_AN1_AN2_AN4_AN5_AN6_AN7_VSS_VREF 1 // A0 A1 A2 A5 E0 E1 E2 VRefh=A3
#define AN0_AN1_AN2_AN3_AN4 2 // A0 A1 A2 A3 A5
#define AN0_AN1_AN2_AN4_VSS_VREF 3 // A0 A1 A2 A4 VRefh=A3
#define AN0_AN1_AN3 4 // A0 A1 A3
#define AN0_AN1_VSS_VREF 5 // A0 A1 VRefh=A3
#define AN0_AN1_AN4_AN5_AN6_AN7_VREF_VREF 0x08 // A0 A1 A5 E0 E1 E2 VRefh=A3 VRefl=A2
#define AN0_AN1_AN2_AN3_AN4_AN5 0x09 // A0 A1 A2 A3 A5 E0
#define AN0_AN1_AN2_AN4_AN5_VSS_VREF 0x0A // A0 A1 A2 A5 E0 VRefh=A3
#define AN0_AN1_AN4_AN5_VREF_VREF 0x0B // A0 A1 A5 E0 VRefh=A3 VRefl=A2
#define AN0_AN1_AN4_VREF_VREF 0x0C // A0 A1 A4 VRefh=A3 VRefl=A2
#define AN0_AN1_VREF_VREF 0x0D // A0 A1 VRefh=A3 VRefl=A2
#define AN0 0x0E // A0


So is important to look at the header file of any chip before you can use its ADC module
Programming / Re: Microcontrollers by princejude(m): 8:41am On Apr 29, 2013
cogitoErgo:

NOLVP => I really could not get this!


NOLVP => NO Low Voltage Programming

Well done
Programming / Re: Microcontrollers by princejude(m): 5:36pm On Apr 24, 2013
cogitoErgo:
Thanks for the manual. I think what remains for me is to get the PIC development kit!
When you are ready for the PIC development kit, check this link http://www.jutronix.com
They have good development kits with user manual which include many sample codes for beginners.
Programming / Re: Microcontrollers by princejude(m): 11:42am On Apr 22, 2013
cogitoErgo:
OK, @princejude, from my findings on the net, integer variable in ccs c is a little different frm traditional c language! the normal int will declare a 8-bit integer, int16 will declare a 16-bit integer while int32 will do fo 32 bit integer!

You can also declare 8-bit interger as int8 in ccs c

Example of some data types are:


Data types Unsigned
int1 0 or 1
int8 0 to 255
int16 0 to 65535
int32 0 to 4294967295


You can download this ccs c user manual for more info:
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Programming / Re: Microcontrollers by princejude(m): 1:55pm On Apr 15, 2013
hopefullman: ...d code is jst lyk chinese 2me.i jst wish 2 be lyk u.

Did you download the two ebooks I posted their links ? if yes, study them and you will understand the trick
Programming / Re: Microcontrollers by princejude(m): 1:05pm On Apr 15, 2013
.
Programming / Re: Microcontrollers by princejude(m): 2:11pm On Apr 09, 2013
hoodboi: Hw did u knw how to work wit d sensor nd oda components

I will always study there datasheets.

hoodboi: hw did u knw d level to set for d battery

I used the internal Analog to Digital Converter module of the chip to sense the battery level ans also used a variable resistor to calibrate the battery level.
Programming / Re: Microcontrollers by princejude(m): 2:01pm On Apr 09, 2013
NeoTesla: @princejude: Nice work. Very readable code. BTW how did you ensure the blocks were indented. The last time I tried to indent code on nairaland I was unsucessful.

Use the code icon labelled "#"

Before you type the code you want to post,Click the "#" icon and type the code between
 and 
.

[.code]

type your
code here

[./code]
Science/Technology / Re: Cost Of Different Sources Of Electricity In Nigeria by princejude(m): 3:26pm On Apr 08, 2013
Barcholder:

Correction - Solar power is used both as grid tied, hybrid, and Stand alone systems. The batteries are easily charged by the Solar Panels, as long as its properly sized. Everything is accounted for, believe that.

Solar panel (with its charge controller) is just a battery charger. You cannot use it alone without a battery. And battery is always GIGO(Garbage-In-Garbage-Out) in other word,you can never take more than what you put inside the battery.

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

(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. 65
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.