Autor Tema: input state pic 16f628a programado en c por mplab  (Leído 1193 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado chichoduda

  • PIC10
  • *
  • Mensajes: 1
input state pic 16f628a programado en c por mplab
« en: 30 de Septiembre de 2020, 23:51:59 »
pregunta rapida podria alguien explicarme para que sirve el input state y como se usa gracias

Desconectado AccioRw

  • PIC16
  • ***
  • Mensajes: 165
Re:input state pic 16f628a programado en c por mplab
« Respuesta #1 en: 01 de Octubre de 2020, 03:04:35 »
Hola, puedes poner una captura de la funcion donde se vea que parametros tiene y quiza algun comentario ?

Me imagino que por el nombre en si debe retornarte una variable de 8 bits que si separas en valores binarios te quedan 8 pines y ahi tienes el estado de cada pin por ejemplo del puerto B

Desconectado KILLERJC

  • Colaborador
  • DsPIC33
  • *****
  • Mensajes: 8242
Re:input state pic 16f628a programado en c por mplab
« Respuesta #2 en: 01 de Octubre de 2020, 09:12:25 »
la unica funcion que conozco llamada input_state() es una del compilador CCS, como podes ver es importante conocer que compilador estas usando.

Si buscas el manual del compilador dice lo siguiente:

Citar
input_state( )
Syntax: value = input_state(pin)
Parameters: pin to read. Pins are defined in the devices .h file. The actual value is a bit address. For example, port a (byte 5 ) bit 3 would have a value of 5*8+3 or 43 . This is defined as follows: #define
PIN_A3 43 .
Returns: Bit specifying whether pin is high or low. A 1 indicates the pin is high and a 0 indicates it is low.
Function: This function reads the level of a pin without changing the direction of the pin as INPUT() does.
Availability: All devices.
Requires: Nothing
Examples:
Código: C
  1. level = input_state(pin_A3);
  2. printf("level: %d",level);
Example Files: None

Lo importante:
Citar
This function reads the level of a pin without changing the direction of the pin as INPUT() does.
Esta funcion lee el nivel del pin, SIN CAMBIARLE LA DIRECCION, ya que por defecto si usas input, le cambia la direccion.