Hi Eur,

I notice you mention sterm. Would sterm be a project to add to jallib?
And is the required info (schematics, some docs) available?

Joep

2010/3/26  <[email protected]>:
> Revision: 1843
> Author: eur.van.andel
> Date: Fri Mar 26 14:15:16 2010
> Log: added sample prog for MCP9800 temperature sensor
>
> http://code.google.com/p/jallib/source/detail?r=1843
>
> Added:
>  /trunk/sample/18f2585_mcp9800.jal
>
> =======================================
> --- /dev/null
> +++ /trunk/sample/18f2585_mcp9800.jal   Fri Mar 26 14:15:16 2010
> @@ -0,0 +1,84 @@
> +-- Title: measuring temperature with the MCP9800 temperature sensor
> +-- Author: Eur van Andel Copyright (c) 2010, all rights reserved.
> +-- Compiler: 2.4m
> +--
> +-- Description: measure temperature in Celcius, show on LCD
> +-- uses Sterm single pin LCD/keyboard, compatible with HD44780 LCD
> +
> +include 18f2585                     -- test platform is DB016
> +pragma target clock 20_000_000
> +pragma target OSC  HS
> +pragma target XINST disabled
> +pragma target WDT  disabled
> +pragma target LVP  disabled
> +pragma target MCLR external
> +
> +enable_digital_io()
> +
> +const byte LCD_ROWS = 4
> +const byte LCD_CHARS = 20
> +var bit lcd_sterm_pin is pin_A0                 -- ** change this for
> regular HD44780 LCD **
> +var bit lcd_sterm_pin_dir is pin_A0_direction   -- ** change this for
> regular HD44780 LCD **
> +include lcd_sterm_master                        -- ** change this for
> regular HD44780 LCD **
> +
> +include delay
> +include print
> +include format
> +include mcp9800
> +
> +var bit tx_ok
> +
> +-- --------------------------------------  S T A R T  M A I N
>  --------------------
> +
> +-- wait for STERM Slave to power-up and initialize.
> +for 4 loop
> +   lcd_clear_screen()          -- Sterm needs some time after power-up
> +   delay_100ms(2)
> +end loop
> +
> +const byte str0[]="MCP9800 temperature"        -- print banner
> +const byte str1[]="via I2C"
> +
> +lcd_cursor_position(0,0)            -- line 1
> +print_string(lcd, str0)
> +lcd_cursor_position(1,0)            -- line 2
> +print_string(lcd, str1)
> +
> +const byte str3[]="12bit temp set OK   "
> +const byte str4[]="Can't reach MCP9800 "
> +
> +lcd_cursor_position(3,0)            -- line 4
> +tx_ok = mcp9800_set_12_bits_temperature
> +if tx_ok then
> +   print_string(lcd, str3)          -- to see if setup went OK
> +else
> +   print_string(lcd, str4)
> +end if
> +
> +for 8 loop                                                 -- leave banner
> on for a while
> +   delay_100ms(5)
> +end loop
> +
> +lcd_clear_screen()
> +
> +
> +forever loop -- ---------------------------  M A I N  L O O P
>  ----------------------------
> +
> +   lcd_cursor_position(0,0)
> +   format_sword_dec(lcd, mcp9800_centicelsius(), 6, 2)
> +   lcd = " "
> +   lcd = "C"
> +   lcd = " "
> +   lcd = " "
> +
> +   lcd_cursor_position(1,0)
> +   print_sbyte_dec(lcd, mcp9800_celsius())
> +   lcd = " "
> +   lcd = "C"
> +   lcd = " "
> +   lcd = " "
> +
> +   delay_100ms(2)    -- for LCD visibility
> +
> +end loop
> +
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to