Princejude's Posts
Nairaland Forum › Princejude's Profile › Princejude's Posts
1 2 3 4 5 6 7 8 ... 14 15 16 17 18 19 20 (of 20 pages)
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
|
This Embedded System Design Magazine might help someone https://i40.tinypic.com/5bww14.jpg http://www.facebook.com/notes/microscale-embedded/new-release-embedded-systems-magazine/531179500262381 |
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: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 |
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 |
cogitoErgo: I don wait tire fo ur replySorry 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:
|
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. |
cogitoErgo: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:setup_adc(ADC_CLOCK_DIV_8);
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
So is important to look at the header file of any chip before you can use its ADC module |
cogitoErgo: NOLVP => I really could not get this!NOLVP => NO Low Voltage Programming Well done |
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. https://i35.tinypic.com/2vula9j.jpg |
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:
You can download this ccs c user manual for more info: http://www.ccsinfo.com/downloads/ccs_c_manual.pdf |
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 |
. |
hoodboi: Hw did u knw how to work wit d sensor nd oda componentsI will always study there datasheets. hoodboi: hw did u knw d level to set for d batteryI 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. |
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] |
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. |
cheddarking: A house has 7 bedrooms and 2 living rooms....as well as a BQ comprising 1room/livingroom/toiletYes you can use solar energy to power the house but the cost of the solar energy materials and installation for the house can build the same house in another plot of land |
Barcholder: Hi AllFrom your post above,Solar Power looks cheaper but I will like you to note the following points: 1. Solar Power system is made up of: the solar panels/cells (convert the solar energy to electrical energy(DC voltage/current)),solar charge controller (Regulates the converted DC voltage used to charge batteries), DC batteries (used to power up a UPS/Inverter), UPS/Inverter (converts the DC voltage from batteries to 230V AC voltage which you can use to power up your house) 2. Solar power is NOT normally used as a stand-alone power supply. It is used to support an existing power supply such as mains/PHCN or generator. The reason is that the power from solar system depends on the battery current and it will be difficult to fully charge the batteries from the solar panels (unless you have enough millions of naira to waste on panels). For your batteries to last longer, you will need to charge the batteries through Mains(PHCN) or generator. thats my 2cent |
princejude: Exercise 3 : Servo motor control.Yeah am back... Here is the code for the servo motor control:
|
cogitoErgo: Please why is everybody not talking again, where is Princejude and co?I was busy,will try to upload some today |
hopefullman: @princjud.pls is it 2ru dt basic is more simpler than C?can i get a link 2learn Basic.thank uBasic may be more simpler but you will get more online resources/tutorials on C. if you want to learn basic check mikroBasic at mikroElectronika. http://www.mikroe.com/mikrobasic/pic/ |
hoodboi: hi princejude, thank you so much for ur efforts, it is highly appreciated. I want to ask, is there any book in pdf format you can upload to teach programming micro controllers. i downloaded a mplab compiler recently and i now have the proteus simulator. Also, pls among the exercises, can you include one to control the to and fro movement of a motor. thanxExercise 3 : Servo motor control. In this exercise, I will copy some sections of my code in a recent project titled "Automated waste bin". This is a simple wast bin with some automatic controls. The waste bin have an ultrasonic sensor, if you come close to the bin, the bin's door will open and ones you are through and out from the bin, the door will close. The opening and closing of the door was controlled using a servo motor while your distance from the bin was measured using an ultrasonic sensor.
|
cogitoErgo: I wuld like to have an automatic weather station dat culd datalog, etc!That will be a nice project cogitoErgo: i will like help on how to get some of d hardwares!You will get most of the hardware at www.jutronix.com |
Another good ebook http://www.4shared.com/office/vEEqbDro/An_introduction_to_programming.htm |
hopefullman: thank u.must i av 2learn asm b4 learnin c?No. You can learn C without asm. hopefullman: i ws tld dt asm wl let me undstand d pic 4beta resourc alocatn.Asm will help you to be familiar with the PIC registers because you use the register names directly in asm though in my own opinion it was a bit difficult to remember all the mnemonics. I prefer C to Asm because C is more friendly (like human language) hopefullman: i dnt wnt 2spend so much tym on a lang dt wunt realy benefit me much.2nksAll programming languages are ok,and none is better than the other,what you achieved using C you can also achieve it using asm. The major issue is which of the language will be easier to learn. |
Use Google to search for free ebooks on PIC C programming. You can search with the following key words: "ccs c ebook", "PIC C programming ebooks", "pic c programming pdf" If you can download the book in the link below,you are good to go(It is for CCS C ) http://www.4shared.com/office/GzmYwLCl/Embedded_C_Programming__Microc.html |
hopefullman: i cuddnt find pic c tutorials on d net.all i see is sum pic projects in c lang wich i dnt understand.i avnt even find BASIC lang tutorials.pls if u hav a link 2 pic c tutorials pls kindly share.2nk uThere are many C compilers (with enough online resources)for PIC. 1. CCS C www.ccsinfo.com/forum Register with this forum ask questions and also search for sample codes in there code library. 2. MikroC PRO for PIC www.mikroe.com They have some good online ebooks which you can read free from here http://www.mikroe.com/pic/books/ This is there ebook on C: http://www.mikroe.com/products/view/285/book-pic-microcontrollers-programming-in-c/ You can also download there compiler here: http://www.mikroe.com/pic/compilers/ 3. Hi-Tech C |
kemesty: The soldier is in b1. Please how can I upload pics on nairaland?Upload the pics to any free image hosting site such as tinypic.com. Then copy the image link and paste it in nairaland reply or new post. |
http://www.hobbyprojects.com/pic_tutorials/tutorial1.html The above link will be a good start for PIC assembly programming |
hopefullman: I compild ds code and mplab told me build suced bt didnt display d hex file.hw wl i get d hex file.The hex file will be inside your project folder. That is the folder where you saved the MPLAB project. |
hopefullman: I compild ds code...That is assembly language. Why not you start with basic or C language. C language will be easier to learn than assembly |
usisky:That ENC28j60 is a powerful chip, You can get it in Naija at www.microscale-embedded.com |
hoodboi: I want to ask, is there any book in pdf format you can upload to teach programming micro controllers.There is a lot of free microcontroller ebooks (pdf) online. Just google it and be specific on the type of microcontroller and compiler you want to learn' hoodboi: Also, pls among the exercises, can you include one to control the to and fro movement of a motor. thanxWhat type of motor do you want to control.... AC motor, DC motor, Stepper motor or Servo motor ? |
