Search Engine

57 Threads found on Porta Digital Input
My Question is how to use porta, PORTC and PORTE same as I use PORTB and PORTD as digital input/Output? Thanks in advance. Setting the corresponding TRIS bits to 1 will configure the pins as input and setting them to 0 will configure the pins as output. You must disable the ADC and comparator if you
porta,3 is also the Mclr pin of the chip. You will note that your config line states Mclr=ON which tell the chip to act on the input state of the pin RA3 to Reset or Run - so that confilcts with you trying to use it as digital input. Don't have the circuit diagram, but assume the 'switch ' you are talking about is a (...)
hi everyone. i write code use pid digital control brightness (when sunlight in photosynthesis to turn off the lights,when dark >> light ) but i see program program does not run properly .EVERYONE HELP ME: #include <16f877a.h> #include #device *=16 ADC=10 #FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWR
for setting port A and E as digital and disable PSP, is the below code enough, or we need any further declaration ? ADCON1 = 0x07 ; //Disable all analogs CMCON = 7; //Disable all comparators TRISE.f4 = 0; //PSP off trisa=0xff; // porta as input trise=0xff; // porte as (...)
Hi Kazi, porta is bidirectional port, can be digital or analog, Data direction register is TRISA, if you set "1" in TRISA reg the pin will be input, if you set "0" pin will be output (Hemnath explaine this in previous post) ADCON1 register configures the function of pins on porta, to be digital or analog, if (...)
i m using MPLAB 8.85. can anybody tell me that how can i use or change the state of ports my self? is that possible or not. i just wrote a program to turn on an led by making a port hi but when i make the port line hi, in "SFR register" window it goes lo itself without any action. i m sending the code and screen short of the mplab screen.[ATTACH
I PROGRAMM PIC16F876 BY JDM PROGRAMMER AND I Successful in that the programme is to make porta and portc have vlue=5f and i connect MCLR/Vpp to +5V and ocs1 & ocs2 to crystal 4MHZ with 2 capacitor 22pf and Vss(pin#8 &pin#19 to GND and pin#20 to +5V but i do not get any thing what is the problem why porta and portc is not have value
Hi all, I'm currently using ATMEGA16 and I have a question concerning ADC. Can I use some pins of porta for the ADC and in the same time use other pins of that port for digital input output. i.e. can porta be used as mixed port for analog and digital inputs?? Please help ASAP!!!
porta defaults to analog pin functions. You have to turn off both the comparators and also disable the analog mode on any pins you want to use for digital I/O
hi, i am using pic 16f877. and below is a program. Can anyone tell me how should i know the reference voltage as they are all hex numbers. thanks a lot //Sample program for AdvFamLab //Include required header files here #include #include //Declare global variables here volatile int on_time_counter, off_time_counter;
Hi, I having this problem with PIC16F877. Whenever I place a 5v to the input port (PORT A) of PIC16F877, the output ports (PORT B & PORT D) do not have the same 5v as input port... The result is either 1.3mv or 0.6mv when I uses multimeter to measure... Below is the code: #ifndef __CPU_16F877__ #error "This program is tailored for PIC16F8
Hi fara793, Just tell us what output you are getting exactly. If you are trying to output some value on porta, then you need to configure it as digital I/O since it is initialised as analog input pin for ADC after reset. Put ADCON1=6 at the beginning. Also refer to the ADC section in the datasheet.
Hi, Try this instead: program ADC_on_LEDs dim temp_res as word main: ANSEL = 0x04 ' Configure AN2 pin as analog ANSELH = 0 ' Configure other AN pins as digital I/O C1ON_bit = 0 ' Disable comparators C2ON_bit = 0 TRISA = 0xFF ' porta is input TRISC = 0 ' PORTC is output TRISD = 0 ' P
Hi was doing this multiplexing 10 seven segment using pic16f887 but i having a problem in programming hopefully someone can help with it. i manage to on perfectly show number for the 1st to 8th as the port D is used to control the seven segment but the last two digit was not work perfectly as it is always on which i put this 7segemnt in port A.
you are taking input on porta and by default porta is assigned to ADC you need to first configure porta as a digital port in ADCON1 register then proceed forward. it will work
usually PORT A is dedicated to analog signal i.e ADC. IF u wannt accesess PORT A plse define TRISA(try state condition) propery and define the port pinc as ur cosideration like #define porta portabits.bit(0-7) ,SET TRISA
Hi, Since you're using mikroC, you can do this: //ADC Initialization ADCON1.PCFG3 = 1; ADCON1.PCFG2 = 1; ADCON1.PCFG1 = 1; ADCON1.PCFG0 = 0; porta = 0; TRISA = 1; //Initialization done (enough for mikroC) When you need to read it from ADC, you can simply do it like: ADCR = ADC_Read(0); //ADC channel 0 is read, converted to digita
All i want is to make them all normal inputs since I am running out of pins in my project, I tried to make the value of TRISA as 0xff but when i input a switch, it seems that it doesn't read any. What exactly is porta and how it is used?
Also, remember that porta pins may have alternate analogue functions (depending on your microcontroller). So, you need to set the PORT to digital. You may need to disable ADC and comparator. Check the respective datasheet for details. Hope this helps. Tahmid.
here is some example code to initialise porta (from the PIC18F97J60 Family Data Sheet) CLRF porta ; Initialize porta by ; clearing output ; data latches CLRF LATA ; Alternate method ; to clear output ; data latches MOVLW 07h ; Configure A/D MOVWF ADCON1 ; for digital inputs MOVWF 07h ; Configure (...)
Hello. I am programming PIC16f616 microcontroller and having trouble having pins RC0 - RC4 going high as outputs. If you have any suggestion, please let me know. Thank you. #include #include #include #include "delay.h" #define output_high 0xFF #define _XTAL_FREQ (4000000L) #define TRUE 1 __CONFIG(B
well actually.,why can't i get the output exactly as i want it to be??is there initial value stored in each pin of the ic???because if i declare: if porta.0= 1 then trisc.0 = 0 portc.0 = 1 delay_ms(1000) i didn't get portc.0 t
//on/off funcion #include #include __CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT & BORDIS); unsigned int RA0,RA1,RA2,RA3,RB0,RB1,RB2,RB3,RB5; void main(void) { ANSEL = 0x00; //select POTA & PORTB as digital i/o TRISA = 0xFF; //select porta as input TRISB = 0x00; //select PORTB as output (...)
This example code reads analog value from channel 2 (RA2) and displays it on PORTB and PORTC. unsigned int temp_res; void main() { ANSEL = 0x04; // Configure AN2 pin as analog ANSELH = 0; // Configure other AN pins as digital I/O C1ON_bit = 0; // Disable comparators C2ON_bit = 0;
If you use mikroC, it has internal library functions to help you with ADC reading. One example could be as simple as: unsigned int temp_res; void main() { ANSEL = 0x04; // Configure AN2 pin as analog ANSELH = 0; // Configure other AN pins as digital I/O C1ON_bit = 0; // Disable comparators
Hi! I have been working on BIGPIC 5 (use pic 18f8520) on microcode studio. I uses the code that is in the folder examples that comes in microcode studio. This is the code that I use: ' PICBASIC PRO program to demonstrate operation of an LCD in 4-bit mode ' ' LCD should be connected as follows: ' LCD PIC ' DB4 porta.0 '
What model of the PIC18F family are you using in your design? There are often several peripheral modules which share various PORTs, especially porta, you may need to disable these peripheral modules before you can use porta as digital I/O. A few more issues: I would strong recommend you disable the Watchdog Timer in the (...)
i am interfacing lcd with pic-16f873 using mikroc. (8-bit interfacing). i am very new to pic. I have read the datasheet of pic-16f873, i am not understanding ADCON1 function mentioned in porta section!!! 1)why it should be used? As i am not using A/D in this interfacing. 2)what will be the value of ADCON1 for outputting the control signa
what's the problem with my code it tells a CPU overload in proteus do i have a problem in ckt or in program code: Device 16F628A Xtal=20 All_digital true Symbol Led PORTB.3 Symbol sw1 porta.0 Symbol sw2 porta.1 input sw1 input sw2 Output PORTB Dim x As Word x=100 loop: If sw1=0 Then (...)
hi, please i have a problem in my "simple" program , i have this error :main function is not defined here is the program void main() { unsigned int temp_res; float K,I; int J; K=11117.28; I=0.01; J=1; ANSEL = 0x01; // Configure AN2 pin as analog ANSELH = 0; // Configure othe
I am using PIC18LF1220. The output functions (on porta) work fine, however, the input functions on PortB are not working. I have checked hardware connections to Pin and they are fine. I think I am missing something in the code. My code is as below. #include #include #include #include "delay.c" #defin
Hey can somebpdy help me with this code? i try to make a digital thermometer but i don`t know programing. This is the codesbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_bit; sbit LCD_D4 at RB0_bit; sbit LCD_D5 at RB1_bit; sbit LCD_D6 at RB2_bit; sbit LCD_D7 at RB3_bit; sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at T
I am having difficulties having both analog input and digital output on the same port on PIC16F716. On PIC16F716, porta (5 pins) can be used for both analog inputs or digital inputs. I would like to have; RA0/AN0 as analog input and RA2/AN2 as digital (...)
I think you are using porta as input port and PORTC as output port. So, you should replace trisb=0; portb=0; by trisc=0; portc=0; and replace ra0_bit!=1 by porta.F0 != 1 and if you are using LED as the output then 10ms delay is less and you cannot see the blinking of LED. Make delay 500 m
Compiler? Sensor - Analog - digital? If analog, connect it to Analog channel (porta), setting ADC, and read ADC. For example (this is for PIC16F1827): main(){ //initiate ADC: Setting PORT A bits as Analog inputs (if Sensor Outputs connected to RA0, RA1 AND RA2): TRISA = 0b00000111; // setting ANSEL ANSELA = 0b00000111; init_ADC(); (...)
Hello everyone, First of all I am very thankful to this forum for post and great help while reading diff threads. After searching a lot I am posting this thread so as I can get help in solving my problem. mu-pic16f877a using a development board LM324n IC for proximity sensor (checked its working i.e led is glowing and voltage of 4v as ou
Hi I try to use PIC 16F88 with internal RC clock @8MHz but it seem not to work ??? :( What's wrong in my test code ? DEFINE OSC 8 ' 8 MHz OSCCON = %01110110 ' Clock configuration OSCTUNE = %00000000 ' porta / ADC CONFIGURATION CMCON = %00000111 ' Disable analog comparators ANSEL = %00000001 ' Set porta.0 to analog (...)
Here's the code for the ADC. //=================================== //-----ADC intialisation function---- void ADC_init(void) { //---- Initialise ADC ---- ADCON1=0x09; //-- RA0-RA4 AND RE0 are Analogue inputs, rest all are digital pins on porta ADCON0=0x80; //-- Reset to defaults ADCS1=1; //--| // |---- (...)
Set porta to digital port. setup_adc_ports(NO_ANALOGS); setup_adc(ADC_OFF);
I'm using Hi-tech PicC-lite compiler,it comes with some sample C codes.The routines in LCD.c work quite fine for 16F84 but when I change to 16F877 with the same pin connections nothing promts on LCD. The code is below.... Thanx in advance... /* * LCD i
I need a program code which will take analog input voltage from channel 0 of porta, convert it to 10 bit digital binary number, store the number in EEPROM data memory. Take another input from same channel after 15 minutes and again save it to EEPROM data memory. When I press a switch connected with RC0, the LCD connected with POR
Try this Have a look at section 11.2, page 112 of the 16F877 datasheet. There is a table for setting up the ADCON1 register for the porta i/o. Pay particular attention to bit 7. This bit sets up for right or left justification of the ADIN result. For most uses, this bit should be set to '1', right justification. Bits 0-3 of ADCON1 are use
I found this code but i cannot compile it...need help if anybody could tell what wrong with this code..urgent...really3 need help program varyPWM1 dim voltage_duty as byte sub procedure InitMain() ANSEL = 0 ' Configure AN pins as digital I/O ANSELH = 0 porta = 255 TRISA = 255 '
hello, currently we are doing a wireless sensor network using xbee. The Rx and Tx is already succeeded. Right now we're working on how to do a menu selection with lcd display. The execution happen only once and then it stop. We seem to not know what is the problem happen whether the hardware or the programming itself.Here i attach the coding..maybe
This looks like PIC 18F code. Each bit in the TRIS register corresponds to one bit in the port. If the bit is '0' the matching bit in the port is an output, if it is a '1' the bit is an input. You have to think in binary to work out which bits are inputs and outputs and then which bits are 0 or 1. For example: TRISA = 0x00; //all bits a
what model of micro (PIC) would you used? its 8bits, 16bits or 32bits? i'm using PIC 18 series and HI-TECH C code software to program the micro... #include #include #include int ADC_VALUE; /* The value from the analog - digital convertor */ void main(void) {
Hi, The port of ATMEGA is pin addressable. The way each pin is addressed depends on your compiler. eg: In mikroC, I can do porta.1 = 1;or RA1_bit = 1;In AVR Studio GCC (WinAVR), I can do porta |= (1<porta,1You should know that each pin has additional functions, e
Hi, I am new in PIC and I am trying hard to figure out how to make the comparator in PIC 16F877a to work. This is my code #include __CONFIG(0x3F32) void delay(void); int i; void main (void) { TRISA=0b00001111; //set pin0 to pin3 as input porta=0x00; //clear all cvrcon=0x00; //voltage reference off cmcon=0b00001011; //two indepe
Hello , I am presently into a project which uses a PIC16F72 with a MAXQ3180 which is a power measurement IC. If someone knows about PIC programming for Spi , Please have a look at the code written below and please help me. There is a problem in that code . Am not able to find it. Might be I would have not checked some registers. here s my code>
I think tou need to read AVR GCC Tutorial (1) ? Basic I/O Operations ? Suhas?s Blog You are using porta to read the input state (smoke) of the pin , this in not correct, the input register is PINA, PINB... The porta sets the pull-up resistor when the pin is set as input. The above a