Rickey's World of Microcontrollers & Microprocessors : Forum / posts http://www.8051projects.net/ Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet. en-gb 2024-03-28T14:45:20+05:30 contact@nospam.com hourly 1 2000-01-01T12:00+00:00 Re: HC-SR04 displaying random stuff after range 9 http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65870 2024-03-28T14:45:20+05:30 ExperimenterUK We need to see the rest of your code.Comments to explain what is supposed to happen would be useful. Re: HC-SR04 displaying random stuff after range 9 http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65870 2024-03-28T14:45:20+05:30 bhantadox Image Re: HC-SR04 displaying random stuff after range 9 http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65870 2024-03-28T14:45:20+05:30 bhantadox unsigned int get_range(void){ long int timer_val; send_pulse(); while(!INT0); //Waiting until echo pulse is detected while(INT0); //Waiting until echo pulse changes its state timer_val=(TH0<<8)+TL0; lcd_cmd(0x81); lcd_data_string("output:"); lcd_cmd(0x8a); if(timer_val<38000) { cms=timer_val/59; if (cms!=0) { lcd_data(cms+48); if(cms<15) { P1=0xFF; } else{P1=0X00;} } } else { lcd_cmd(0x06); lcd_data_string("Object out of range"); } return cms;} HC-SR04 displaying random stuff after range 9 http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65870 2024-03-28T14:45:20+05:30 bhantadox Im using 8051, LM016L and HC-SR04 for range finder but after range 9 it starts to display random stuff. Re: 8051 keypad and LED question http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65868 2024-03-28T14:45:20+05:30 ExperimenterUK To use this kind of keypad you must "scan" it,This means setting pins P2.1,P2.2 and P2.3 high then low one after the other.Your pins do not change, so pressing a key does nothing. 8051 keypad and LED question http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65868 2024-03-28T14:45:20+05:30 fortresmaximus Hi guys, i am new here. I need to create project with microcontroller 8051,in project i want to use KEYPAD-PHONE and 4 LED (for example if i click 1 on keypad - first LED will light up, Could someone give me a hint what i am doing wrong? 8051/ 8052 Microcontroller Code Site. http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65867 2024-03-28T14:45:20+05:30 Tressie Just a quick note to let everyone know that my 8051/ 8052 Microcontroller Code distribution website is back online, and has a new home at:https://green.bug-eyed.monster/Please feel free to stop by, grab some handy code projects, and leave a comment or two.It's a new website, with no PR as yet, so helping to popularise the site by linking to it, will help everyone know it's available.T. Erasing AT89S52 error http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65866 2024-03-28T14:45:20+05:30 cainho07 Hello everyone!I recently bought a brand new AT89S52 and an USBasp programmer for practicing and studying. Took a lot of time to get everything working between drivers and USBasp firmwares until I finally made it but unfortunately, I think I accidentally wrote the lock bits because I didn't check the lock option. Now it says that Mode 3 lock is active with B1 = 1 and B2 = 0. I've hit the erase chip button many times but when I read the lock bits status, it always remain the same. Apparently, the new .hex files are working when I try to write but is there a way to really erase the chip or did I brick it? Thanks in advance! Re: Automatically sending of SMS via Nokia 3310 http://www.8051projects.net/plugins/forum/forum_viewtopic.php?2590 2024-03-28T14:45:20+05:30 jacksonjk My Nokia phone will not send SMS to short 5-digit numbers. I continually receive the message in red saying "Not sent, tap to try again.". It doesn't matter how many times I tap, and try, the same failure message appears. Where in the settings can I overcome this?Source: www.smsala.com Re: microcontroller http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65814 2024-03-28T14:45:20+05:30 liqian I found the part on here https://www.jotrin.com/product/parts/74HC595, there is detail information about it and I hope it can really help you. Re: AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 ExperimenterUK PS: I am a new learner thats why my question may sound silly. Not silly at all.There are a lot of details experts don't tell you that are really hard to figure outon your own.You will need a special header for the AT89LP2052 as it uses registers the 8051 does not have.The header will also have to written for use in Microc as every compiler has it's own way of doing things.For a quick test I think this will work.Add these 2 lines to the top of the file#define P1M0 0xc2#define P1M1 0xc3and these 2 at the start of main.P1MO= 0x00;P1M1= 0x00;Some P1 pins are used for programming, so I suggest you only connect a LED to pin 14 ( P1.2)Also it is safer to add resistors between the LEDs and the chip.Anything between 47 and 200 ohms should be okay.To start with, try this program to turn the LEDs on.That will prove something is working, you can do flashing later. #include<reg51.h> #define P1M0 0xc2 #define P1M1 0xc3 void main() { P1MO= 0x00; P1M1= 0x00; P1= 0xff while(1) {} } Re: AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 Mirza123 Thanks for the assistance. I have read the data sheet. if PxM0.y=0 and PxM1.y=0 then it will work as standard 8051MCU. but i want to know how can i make PxM0.y=0 and PxM1.y=0 ? which special function register should be changed? Should i use the same header file( #include<reg51.h>)? PS: I am a new learner thats why my question may sound silly. Re: AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 ExperimenterUK See section 15 (Ports) of the data sheet.


Attachment





doc3547.zip








Re: AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 wimac How did you know that it is not 8051. Mirza123It is really important when dealing with a new chip to have a good read of the datasheet. In this case you need to read the sections dealing with I/O Ports. Have a look at page 8, section 7.7 and section 15 starting on page 20 and see if that helps. Re: AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 Mirza123 It seems ports on the AT89LP2052 is not like on the 8051,so your program may not work.ExperimenterUKHow did you know that it is not 8051. I have put full week dealing with this chip but i did not work. I have attached the circuit schematic also which i am using. Re: AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 ExperimenterUK It seems ports on the AT89LP2052 are not like on the 8051,so your program may not work.If you have not got it working, let me know and I'll look intowhat is needed to set up the ports. AT89LP2052 connection http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65855 2024-03-28T14:45:20+05:30 Mirza123 Hello!i am trying to use AT89LP2052 ( AT89LP2052 http://ww1.microchip.com/downloads/en/devicedoc/doc3547.pdf) for LED to turn on and OFF. but i am confused with the connections.I have used i have loaded the program by using 8051Flash program. For writing the program i have used 8051-Ready board(https://download.mikroe.com/documents/starter-boards/ready/8051/8051ready-manual-v100.pdf) and mikroprog-8051 (https://www.mikroe.com/mikroprog-8051).here is the code which i have learnt from your course. #include<reg51.h> // for 11.0592MHz Crystal void delay(unsigned int count) { unsigned int i; while(count) { i=115; while(i> 0) i--; count--; } } void main() { while(1) { P1 = 0x00; delay(1000); P1 = 0xff; delay(1000); } } Can you please help me with the connection? Re: Need help with Schematics http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65848 2024-03-28T14:45:20+05:30 ExperimenterUK It is about capacitor? i should put it between Vcc and gnd?Yes. I Dont understand what is wrong with reset.There is nothing wrong with your reset.It is just that you need to turn the power off to reset the circuit.If you add a push button you can do a reset while leaving the power on.Sometimes that is useful for testing and programming.Voltage source is 5V. Should i use voltage regulator? No a five volt supply is fine.I was just looking for reasons why your professor might be was worried.He might think your supply is more than five volts. Re: Need help with Schematics http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65848 2024-03-28T14:45:20+05:30 cerouno Take another look at the power supply to the LCD.A reset button is handy for testing.If the supply is no more than five volts, I don't see why the supply,or anything else, would burn out.I might have missed something.ExperimenterUKIt is about capacitor? i should put it between Vcc and gnd?Dont understand what is wrong with reset.Voltage source is 5V. Should i use voltage regulator? Re: Need help with Schematics http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65848 2024-03-28T14:45:20+05:30 ExperimenterUK Take another look at the power supply to the LCD.A reset button is handy for testing.If the supply is no more than five volts, I don't see why the supply,or anything else, would burn out.I might have missed something. Need help with Schematics http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65848 2024-03-28T14:45:20+05:30 cerouno I am working on Smart parking project. Here is my schematic. I sent this to my professor and he said it is not right, i am not sure why. Also he said if i connect this to power source it will burn the source. I am new at this so i really need help. What am i doin wrong? 8051 MULTIPLICATION http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65847 2024-03-28T14:45:20+05:30 xrxx BCD MULTIPLICATIONAssume that you have to 2 BCD numbers in 2 registers/memory locations. Write a subroutine to multiply these 2 numbers and put the result in a different register set/memory location. The maximum number can be 9801 (99*99=9801). So you need 2 bytes to store 4-BCD digits.Execute your program in the simulator and get screenshots at several steps during the execution.Put your code and screenhots in a zip file seperately and submit the zip file as name_surname_id_hw1.zipSWAP is good instruction to switch lower and higher nibbles (4-bits) in A.Repeat the steps we follow on the paper.Guys, can u help me for this? pleaseeeee Re: Detect magnet position with Hall effect sensor http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65340 2024-03-28T14:45:20+05:30 liqian I happened to see your post and I got many useful pieces of information, thank you so much Re: problem real pic simulator MPLabx http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65841 2024-03-28T14:45:20+05:30 ExperimenterUK The code is hard to read.Please zip it and attach it to your post.Before you zip, it please add lots of comments to explain how each part works.Imagine you are explaining each step to someone who has never seen your project before.This is good practise, because if you come back to this code in a few months you will have forgotten how it works.Also please zip and post a circuit diagram, even if it is only a rough sketch. Re: problem real pic simulator MPLabx http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65841 2024-03-28T14:45:20+05:30 rogermado @ExperimenterUK, thanks for your reply. You'll find the code below. thanks again RogerMado;**********************************************************************; This file is a basic code template for assembly code generation *; on the PIC16F877A. This file contains the basic code *; building blocks to build upon. * ; *; Refer to the MPASM User's Guide for additional information on *; features of the assembler (Document DS33014). *; *; Refer to the respective PIC data sheet for additional *; information on the instruction set. *; *;**********************************************************************; *; Filename: xxx.asm *; Date: *; File Version: *; *; Author: *; Company: *; * ; *;**********************************************************************; *; Files Required: P16F877A.INC *; *;**********************************************************************; *; Notes: *; *;********************************************************************** list p=16f877A ; list directive to define processor #include <p16f877A.inc> ; processor specific variable definitions __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _RC_OSC & _WRT_OFF & _LVP_ON & _CPD_OFF; '__CONFIG' directive is used to embed configuration data within .asm file.; The lables following the directive are located in the respective .inc file.; See respective data sheet for additional information on configuration word.;***** VARIABLE DEFINITIONSw_temp EQU 0x7D ; variable used for context saving status_temp EQU 0x7E ; variable used for context savingpclath_temp EQU 0x7F ; variable used for context saving CNT_7_SEG EQU 0X24 ORG 0x000 ; processor reset vector nop ; nop required for icd goto main ; go to beginning of program ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register movf PCLATH,w ; move pclath register into w register movwf pclath_temp ; save off contents of PCLATH register test_1 BTFSS INTCON,INTF goto test_2 call service_interrupt_2 test_2 BTFSS INTCON,RBIF goto Sortir call service_interruptSortir movf pclath_temp,w ; retrieve copy of PCLATH register movwf PCLATH ; restore pre-isr PCLATH register contents movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interruptmain call ConfigPortB ; RB3 en output RB0:RB2 en input RB4:RB7 en input call ConfigPortD ; configuration du portd en output call ConfigPortC ; configuration de RC0 en output call ConfigPortA ; configuration du porta en input call configinte BSF PORTC,RC0 ; alimente le 7 segments movlw 0X3f movwf PORTDbouclereset_zones BTFSS PORTC,RC1 goto boucle_reset movlw 0Xf7 movwf PORTDboucle_reset goto boucle goto $JUMP_TO_BANK1 BSF STATUS,RP0 BCF STATUS,RP1RETURNJUMP_TO_BANK0 BCF STATUS,RP0 BCF STATUS,RP1RETURNConfigPortA CALL JUMP_TO_BANK1 MOVLW 0X11 movwf TRISA call JUMP_TO_BANK0returnConfigPortB CALL JUMP_TO_BANK1 movlw B'11111111' movwf TRISB CALL JUMP_TO_BANK0returnConfigPortD CALL JUMP_TO_BANK1 MOVLW 0X00 MOVWF TRISD CALL JUMP_TO_BANK0returnConfigPortC CALL JUMP_TO_BANK1 movlw 0XFE movwf TRISC CALL JUMP_TO_BANK0returnconfiginte CALL JUMP_TO_BANK1 movlw 0X98 movwf INTCON movlw 0X80 movfw OPTION_REG CALL JUMP_TO_BANK0 returnservice_interrupt movf PORTB,W BCF INTCON,RBIF movwf PORTB BCF INTCON,GIETEST1 BTFSS PORTB,RB4 GOTO TEST2 GOTO SHOW1TEST2 BTFSS PORTB,RB5 GOTO TEST3 GOTO SHOW2TEST3 BTFSS PORTB,RB6 GOTO TEST4 GOTO SHOW3TEST4 BTFSS PORTB,RB7 GOTO end_interrupt GOTO SHOW4SHOW1 movlw 0X06 movwf PORTD GOTO end_interruptSHOW2 movlw 0X5B movwf PORTD GOTO end_interruptSHOW3 movlw 0X4F movwf PORTD GOTO end_interruptSHOW4 movlw 0X66 movwf PORTD GOTO end_interruptend_interrupt returnservice_interrupt_2 BCF INTCON, GIE BCF INTCON, INTF movlw 0XF7 movwf PORTD return end Re: problem real pic simulator MPLabx http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65841 2024-03-28T14:45:20+05:30 ExperimenterUK Some simulators handle displays better than others.If you post as much of your code and circuit diagram as possible we can try it in "Real Pic Simulator" and Proteus.Meanwhile try writing test code to do very simple thingssuch as displaying just one character.First find what works.. then add to it. problem real pic simulator MPLabx http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65841 2024-03-28T14:45:20+05:30 rogermado Hello everyone, sorry in advance if i'm not in the right section of the forum to ask this question : Well, i'm making a school project based on the PIC16F877A. And i have already written the code in MPLabx IDE 5.35. I've simulated it on MPLabX and it worked just fine! the problem is when i use the software "REAL PIC SIMULATOR" i'm not able to make it work. The 7seg display stucks and the results i'm waiting are pretty weird and impredictable. By the way, i build the code i wrote on MPLAB in a hex file then i opened it on Real Pic Simulator.I wonder if there is a "good" way to go from MBLab to Real pic simulator with no problems along the way. Thank you very much in advance for your help,RogerMado PIC X IDE Debugger speed http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65839 2024-03-28T14:45:20+05:30 PHANTOM28 Hi.I hope you all can help me. I am relatively new to the pic microcontrollers and haven't used one in many years. Just so I can familiarize myself I am just going through simple C routines before doing something more interesting. I have loaded Microchip X IDE (V5.30) and done a very simple C program that shifts 1 bit on PORTB one at a time at a time. It complies and works no problem. When in simulator mode (debugger) I can single step through it, but when running I would like the speed of the debugger to be very slow about 2 seconds before it executes the next instructs, so I can see the output values rather (a bit like single stepping) also like to see which line is being executed. I used to be able to do this in MPLAB IDE V8.63. It's driving me crazy, I've checked all option but cannot see how to do that. Re: How can i calculate minimum ISR interval for nuvoton -8051(8bit)? http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65831 2024-03-28T14:45:20+05:30 ExperimenterUK Did you sort out your problem? Re: Greenhouse Monitoring http://www.8051projects.net/plugins/forum/forum_viewtopic.php?65835 2024-03-28T14:45:20+05:30 ajay_bhargav Yes you can do that.1. Create a channel @Thingspeak and create fields for parameters that are going to be updated by your device. (in your case temperature and Humidity)2. On your device generate HTTP GET request to update those fields.Open socket connection to api.thingspeak.com @80Send get request as follows:GET /update?api_key=&temp=&humid=[cr][lf][cr][lf]I used temp and humid as field names. You can change them to whatever you have created in channelPlease mind that cr (carriage return \r) and lf (line feed \n) are part of get request. So prepare the request carefully if you want everything to be success.