![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| Experienced Member |
__________________ My home made 2.1 System Nokia 3310 Lcd & Pic12F629 3 channel IR remote Controller Project using 12F Pic Pasan... Last edited by pasanlaksiri; 23rd May 2007 at 08:03 AM. |
| | |
| | (permalink) |
| Experienced Member | Very Shnazzy!
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net |
| | |
| | (permalink) |
| Experienced Member | I agree, it is very shnazy! Nice! |
| | |
| | (permalink) |
| Experienced Member | You win the prize for the longest delay routine ever. Code: procedure delay_1us( byte in x ) is
if target_cpu == sx_12 then
pragma keep page, bank
-- cycles for argument passing, call and return
const call_overhead = 14
if target_clock > 10_000_000 then
const once_through = 16
const overhead =
( ( ( call_overhead + once_through ) * 1_000_000 ) / target_clock )
const one_us_cycles = target_clock / 1_000_000
const outer_loop_overhead = 12
const inner_loops =
( one_us_cycles - outer_loop_overhead - 6 ) / 4
var byte outer_counter, inner_counter
const byte yy = - ( overhead + 1 )
const byte zz = inner_loops + 1
assembler
local outer_loop, inner_loop
-- get argument, substitute zero if too small
movlw yy
bank addwf x, w
skpc
movlw 0
-- make local copy
bank movwf outer_counter
incf outer_counter, f
-- outer loop must take 1uS
outer_loop:
-- inner loop takes 6 + 4 * n
movlw zz
bank movwf inner_counter
page inner_loop
inner_loop:
decfsz inner_counter, f
goto inner_loop
-- outer loop again?
page outer_loop
bank decfsz outer_counter, f
goto outer_loop
end assembler
elsif target_clock == 10_000_000 then
const overhead_us = ( call_overhead + 16 ) / 10
var byte counter
const byte abc = - overhead_us
assembler
local loop, next
-- get argument, correct for overhead, minimum is zero
movlw abc
bank addwf x, w
skpc
movlw 0
-- loop, total cycles in assembler block is 16 + 10 * n
bank movwf counter
incf counter, f
loop:
nop
page goto next
next:
page loop
decfsz counter, f
goto loop
end assembler
elsif target_clock == 4_000_000 then
const overhead_us = ( call_overhead + 11 ) / 4
var byte counter
var byte xyz = - overhead_us
assembler
local loop
-- get argument, correct for overhead, minimum is zero
movlw xyz
bank addwf x, w
skpc
movlw 0
-- loop, total cycles in assembler block is 11 + 4 * n
bank movwf counter
incf counter, f
page loop
loop:
decfsz counter, f
goto loop
end assembler
else
pragma error -- clock must be 4 or >=10 MHz
end if
elsif ( target_cpu == pic_14 ) | ( target_cpu == pic_12 ) then
const ips = target_clock / 4
if target_clock >= 10_000_000 then
const i_iteration = 5
const i_overhead = 9
const d_iteration = ( i_iteration * 1_000_000 ) / ips
const d_overhead = ( i_overhead * 1_000_000 ) / ips
const x_iteration = - d_iteration
const x_overhead = - ( d_overhead + ( d_iteration / 2 ) + 1 )
var byte v_overhead = x_overhead
var byte v_iteration = x_iteration
assembler
local loop
page loop
movfw x
addwf v_overhead, w
loop:
skpc
retlw 0
addwf v_iteration, w
goto loop
end assembler
elsif target_clock == 4_000_000 then
const i_iteration = 4
const i_overhead = 9
const d_iteration = ( i_iteration * 1_000_000 ) / ips
const d_overhead = ( i_overhead * 1_000_000 ) / ips
const x_iteration = - d_iteration
const x_overhead = - ( d_overhead + ( d_iteration / 2 ) + 1 )
var byte v_overhead = x_overhead
var byte v_iteration = x_iteration
assembler
local loop
page loop
movfw x
addwf v_overhead, w
skpc
retlw 0
loop:
addwf v_iteration, w
skpnc
goto loop
end assembler
else
pragma error -- clock must be 4 or 10 MHz
end if
else
pragma error -- cpu must be sx_12 or pic_14
end if
end procedure Mike. |
| | |
| | (permalink) |
| Experienced Member | What does it mean by shnazzy? There is no such word in my English dictionary.. pasanlaksiri, it looked nice, but why don't you scale down your picture? It is 1.3 MP BTW, is the LCD light always on? Or it can be controlled whether you want to on or off?
__________________ Superman Returns.. http://www.supermanhomepage.com/imag...an-returns.gif My friend created this account for me.. LOL http://bananasiong.myminicity.com oh.. somemore http://bananasiong.myminicity.com/env |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Hmm LCD back light. U can use little sw for turn it off and on.
__________________ My home made 2.1 System Nokia 3310 Lcd & Pic12F629 3 channel IR remote Controller Project using 12F Pic Pasan... | |
| | |
| | (permalink) |
| Experienced Member | pasanlaksiri, did you actually make that clock? Is code and design made by you? I can't wait for the answer... ... |
| | |
| | (permalink) | |
| Experienced Member | Quote:
Actually im wating for my ordered 20X4 LCD.
__________________ My home made 2.1 System Nokia 3310 Lcd & Pic12F629 3 channel IR remote Controller Project using 12F Pic Pasan... | |
| | |
| | (permalink) | |
| Experienced Member | Quote:
| |
| | |
| | (permalink) | |
| Experienced Member | Quote:
This is the link for schematics and info
__________________ Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net | |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Problem with LCD code? | spondootre | Micro Controllers | 15 | 29th April 2008 09:15 AM |
| PIC16F877 ADC programming with PicBasic Compiler | Erwin_Macaraig | Micro Controllers | 10 | 4th November 2004 10:46 AM |
| Help me on basketball's game clock and shot clock! | syaw_007 | Electronic Projects Design/Ideas/Reviews | 1 | 6th September 2004 09:50 PM |
| Turn 'off' a relay using alarm clock...(help) | bd13 | Electronic Projects Design/Ideas/Reviews | 3 | 1st September 2004 12:01 AM |
| Need A Simple Alarm Clock Circuit | Handiplus | Electronic Projects Design/Ideas/Reviews | 0 | 29th March 2004 02:01 PM |