uControl
Mayo 17, 2012, 03:36:39 *
Bienvenido(a), Visitante. Por favor, ingresa o regístrate.
¿Perdiste tu email de activación?

Ingresar con nombre de usuario, contraseña y duración de la sesión
 
   Inicio   Ayuda Buscar Ingresar Registrarse  
Páginas: [1]   Ir Abajo
  Imprimir  
Autor Tema: Librerías para JAL  (Leído 1191 veces)
0 Usuarios y 1 Visitante están viendo este tema.
lmtreser
Moderador
PIC18F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 1143



WWW
« : Junio 09, 2011, 12:27:27 »

Algunas librerías que encontre de casualidad y pueden ser utiles:

jpic628a.jal. Acceso a los periféricos del PIC16F628, eeprom y usart.
nibsBPs.jal. Convierte bytes en nibbles (altos y bajos) y pares de bits.
shiftIn.jal. Desplazamiento de datos usando un reloj y un pin de datos.
shiftOut.jal. Desplazamiento de datos usando un reloj y un pin de datos.

Fuente: http://www.semifluid.com/?p=14

* jal_libs.zip (7.79 KB - descargado 67 veces.)
« Última modificación: Junio 09, 2011, 12:33:17 por lmtreser » En línea

Felixls
Moderator
PIC24F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 2944



WWW
« Respuesta #1 : Julio 05, 2011, 09:06:53 »

Biblioteca para conectar un LCD, modo 4 bits, via datos serie (3-wire - Data, Clock, Enable)



Su uso es igual a la biblio de Jallib :

Código:
const byte LCD_ROWS    =  2           -- LCD with 2 lines
const byte LCD_CHARS   =  16          -- and 16 characters per line

var byte hello[LCD_CHARS] = "Hello World"

include lcd_hd44780_3wires
lcd_init()

lcd_clear_screen()
for LCD_CHARS using i loop
   lcd_write_char(hello[i])        -- write using procedure)
end loop

Si desean agregar un custom char, como el signo de grados:

Código:
const byte signogrado[] =
{  
0b_00001100,
0b_00010010,
0b_00010010,
0b_00001100,
0b_00000000,
0b_00000000,
0b_00000000,
0b_00000000
}

lcd_define(0, signogrado)

lcd = "-"
lcd = "1"
lcd = 0   --envía el signo grado

Ese código mostrará -10 en el display.

Link:
http://www.ucontrol.com.ar/forosmf/jal-y-jalv2/librerias-para-jal/?action=dlattach;attach=9611

* lcd.jpg (68.3 KB - descargado 294 veces.)
* lcd_hd44780_3wires.jal (6.05 KB - descargado 84 veces.)
« Última modificación: Julio 05, 2011, 09:09:23 por Felixls » En línea
lmtreser
Moderador
PIC18F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 1143



WWW
« Respuesta #2 : Julio 12, 2011, 02:12:16 »

Biblioteca de punto flotante que armo Felixls. No es recomendable usar esta biblioteca salvo que sea realmente indispensable, raros casos digamos.

http://code.google.com/p/jalv2-32bits-floating-point-routines/
En línea

lmtreser
Moderador
PIC18F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 1143



WWW
« Respuesta #3 : Octubre 22, 2011, 11:38:22 »

Librería para el manejo de strings:

Código:
-- ----------------------------------------------------------------------------
-- Title: String manipulation
-- Author: Mohammad Hafiz Othman, Copyright (c) 2010, All rights reserved.
--
-- Released under the ZLIB license (http://www.opensource.org/licenses/zlib-license.html)
--
-- Description: - String manipulation
-- cstr[] -> constant string.
-- str [] -> string pointer.
-- char   -> ASCII character

const        byte STRING_MAX           = 255

-- this holds temp string for string manipulation
var volatile byte _tmpStr[STRING_MAX + 1]

-- ----------------------------------------------------------------------------
-- Returns the string length.
-- ----------------------------------------------------------------------------

function StrLen (byte in str[]) return byte is
   var byte i
   for STRING_MAX using i loop
       if str[i] = 0 then
          return i
       end if
   end loop
   return STRING_MAX
end function

-- ----------------------------------------------------------------------------
-- Returns the string length. (const)
-- ----------------------------------------------------------------------------

function StrLenC (byte in cstr[]) return byte is
   return count(cstr)
end function

-- ----------------------------------------------------------------------------
-- Find char in string
-- ----------------------------------------------------------------------------

function FindStr (byte in str[], byte in char) return bit is
   var word len = StrLen (str)
   var byte i
   for len using i loop
      if str[i] = Char then
         return true
      end if
   end loop
   return false
end function

-- ----------------------------------------------------------------------------
-- Find char in string (const)
-- ----------------------------------------------------------------------------

function FindStrC (byte in cstr[], byte in char) return bit is
   var word len = count(cstr)
   var byte i
   for (len + 1) using i loop
      if cstr[i] = char then
         return true
      end if
   end loop
   return false
end function

-- ----------------------------------------------------------------------------
-- Find char in string (reverse mode)
-- ----------------------------------------------------------------------------

function FindStrRev (byte in str[], byte in char) return bit is
   var byte i
   i = StrLen (str[])
   if i != 0 then
      -- find char, reverse mode.
      repeat
         if str[i] == char then
            return true
         end if
         i = i - 1
      until i == 0
   end if
   return false
end function

-- ----------------------------------------------------------------------------
-- Find char in string (reverse mode), const
-- ----------------------------------------------------------------------------

function FindStrRevC (byte in cstr[], byte in char) return bit is
   var byte i
   i = count (cstr[])
   if i != 0 then
      i = i + 1
      -- find char, reverse mode.
      repeat
         if cstr[i] == char then
            return true
         end if
         i = i - 1
      until i == 0
   end if
   return false
end function

-- ----------------------------------------------------------------------------
-- Returns a specified number of characters from the left side of a string
-- ----------------------------------------------------------------------------

procedure Left (volatile byte in out str[], byte in length) is
   if length > 0 then
      var byte len
      var byte i
      len = StrLen (str[])
      if length < len then
         str[length] = 0
      end if
   end if
end procedure

-- ----------------------------------------------------------------------------
-- Returns a specified number of characters from the right side of a string
-- ----------------------------------------------------------------------------

procedure Right (volatile byte in out str[], byte in length) is
   if length > 0 then
      var byte len
      var byte i
      len = StrLen (str[])
      if length < len then
         -- recopy to string.
         for (len - length) using i loop
            str[i] = str[i + length]
         end loop
         str[length] = 0
      end if
   end if
end procedure

-- ----------------------------------------------------------------------------
-- Returns a repeating character string of the length specified
-- ----------------------------------------------------------------------------

procedure String (volatile byte out str[], byte in char, byte in length) is
   var byte i
   for length using i loop
      str[i] = char
   end loop
   str[length] = 0
end procedure

-- ----------------------------------------------------------------------------
-- Reverse a string
-- ----------------------------------------------------------------------------

procedure StrReverse (volatile byte in out str[]) is
   var byte len
   var byte i
   len = StrLen (str[])
   -- copy string to temp string.
   for len using i loop
      _tmpStr[i] = str[len - i]
   end loop
   -- recopy to string.
   for len using i loop
      str[i] = _tmpStr[i]
   end loop
end procedure

-- ----------------------------------------------------------------------------
--  Returns a copy of a string without leading spaces
-- ----------------------------------------------------------------------------

procedure LTrimStr (volatile byte in out str[]) is
   var byte len
   var byte i
   var byte tmp
   len = StrLen (str[])
   tmp = len
   -- find space.
   for len using i loop
      if str[i] != " " then
         tmp = i
         exit loop
      end if
   end loop
   if tmp != len then
      -- recopy to string.
      for (len - tmp) using i loop
         str[i] = str[i + tmp]
      end loop
      str[len - tmp] = 0
   else
      str[0] = 0
   end if
end procedure

-- ----------------------------------------------------------------------------
--  Returns a copy of a string without trailing spaces
-- ----------------------------------------------------------------------------

procedure RTrimStr (volatile byte in out str[]) is
   var byte i
   i = StrLen (str[])
   if i != 0 then
      -- find space, reverse mode.
      repeat
         if str[i] != " " then
            exit loop
         end if
         i = i - 1
      until i == 0
      str[i] = 0
   end if
end procedure

-- ----------------------------------------------------------------------------
--  Compare a string
-- ----------------------------------------------------------------------------

function StrCmp (volatile byte in str1[], volatile byte in str2[]) return bit is
   var byte lena
   var byte lenb
   var byte i
   lena = StrLen (str1[])
   lenb = StrLen (str2[])
   if lena == lenb then
      -- process
      for lena using i loop
         if str1[i] != str2[i] then
            return false
         end if
      end loop
      return true
   end if
   return false
end procedure

* jstring.jal (7.07 KB - descargado 42 veces.)
« Última modificación: Octubre 22, 2011, 11:43:55 por lmtreser » En línea

lucho512
Amigo de uControl
PIC16F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 704


No le des Tele, No le des Futbol, DALES UNA PALA!!


WWW
« Respuesta #4 : Octubre 22, 2011, 03:03:14 »

Gracias lmtreser biene al pelo!!!  Grin
En línea

Vamos Argentina, las Malvinas siempre seran nuestras!!!!
Leon Pic
Moderador
PIC24F
*****
Desconectado Desconectado

Sexo: Masculino
Mensajes: 4630


Cumulonimbus


WWW
« Respuesta #5 : Diciembre 12, 2011, 03:08:52 »

Librería para manejar el puerto serial del PIC. El mismo se puede configurar para habilitar la interrupción por recepción o fin de transmisión de datos. Otra particularidad que tiene, y es más importante, maneja el noveno bit como bit de paridad.

La rutina, no es 100% mía, sino que es una adaptación que trae el JALv2. Solo he agregado el manejo del noveno bit, la habilitación de la interrupción y la traducción al castellano.

Espero le sea de utilidad.

* serial_hardware_sa.jal (13.11 KB - descargado 51 veces.)
En línea

Jesús dijo, yo soy el Camino, la PAZ y la VIDA, nadie llega al PADRE si no es por mi.
Páginas: [1]   Ir Arriba
  Imprimir  
 
Ir a:  

Impulsado por MySQL Impulsado por PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
XHTML 1.0 válido! CSS válido!
Página creada en 0.085 segundos con 28 consultas. (Pretty URLs adds 0.024s, 3q)
loggkey