Proteus, KiCAD и другие ECAD Разработчик так или иначе сталкивается с системами автоматизированного проектирования. Данный раздел - по САПР. |
07.10.2006, 16:58
|
|
Частый гость
Регистрация: 20.04.2005
Сообщений: 30
Сказал спасибо: 36
Сказали Спасибо 3 раз(а) в 2 сообщении(ях)
|
На чём написано ???
; software: ver.6
;***************** Dec. 3rd. 2002 **************************
; Written by Flemming Jensen
; Zeroing on pwr-up
; Low battery indicator
;
; No diode in series with "nF" range resistor
; (instead the Pic pin connected to the nF resistor
; is programmed as input when not used, i.e. made Hi-Z)
;
; pF/nF/uF and up to ›1F
; rolls over from 999pF to 1.00nF and 9.99nF to 10nF etc.
; pF procedure is run twice, mean value is used. This way
; hum influence is reduced.
; (uF range selected via a pnp, and so 1=off, 0=on)
; In mF procedure, is "wait" signalled when measuring.
; "ready" is shown when mF procedure has been run 4 times.
; meter has to be reset by on/off when ready has been shown.
; p.g.a. for stor fejlvisning over 5000uF er der nu indlagt
; en "wait" pе 1500mS i uF proceduren
;
;************************************************* ************
#compiler clock = 20000 ; 20 MHz clock
#ASM list p=16C84
#fuse CP_OFF + PWRT_ON + WDT_OFF + XT_OSC
var charout : byte ; character output to lcd
var flags : byte ; boolean byte
var lcdData : bit 0 of flags ; T = data or F = command
var lcdbusy : bit 1 of flags ; lcd busy flag
var talx : word ; contains the cap. value
var talx1 : word
var talx2 : word
var a : byte ; holds number of 1000's
var nb : byte ; holds number of 100's
var c : byte ; holds number of 10's
var d : byte ; holds number of 1's
var p : byte ; prefix ( p n u m )
var y : byte ; insert dec.point ?
var z : word ; open lead cap.
var zz : word ; open lead cap.
var tempcount : byte ; for delay uF range
var delaycount : byte
var q : byte ; holds batt. condition
var rdy : byte ; holds how many F proc.
var proc : byte
alias(RB4,lcdportD4) ; rename port RBx to lcdportDx
alias(RB5,lcdportD5)
alias(RB6,lcdportD6)
alias(RB7,lcdportD7)
alias(RA0,lcd_rs) ; lcd register select
alias(RA1,lcd_en) ; lcd enable
alias(RA2,lcd_rw) ; lcd read/write
alias(RB0,bat) ; RB0 lo bat
alias(RB1,range_uF) ; range select
alias(RB2,range_nF)
alias(RB3,reset) ; reset 555
alias(RA3,trig) ;trigger for 555
alias(RA4,out_555) ;output pulse from 555
procedure(MAIN)
InitPort ; set up ports
InitLCD ; initialise lcd display
reset = 1 ; reset 555 high
trig = 1
clr(z) ; reset zeroing var
clr(rdy) ; rdy reset
pFzero ; open leads cap is stored just after pwr-up
while true
clr(proc)
pF ; pF procedure (000pF-9,99nF)
if proc = 0 then
begin
talx1 = talx ; 2 times meas. (hum reduction)
wait(10)
pF
talx2 = talx
wait(10)
talx = (talx1 + talx2)/2
end
DoMessage
loop
procedure(pFzero) ; incr. talx, when 555 is high
clr(y) ; no dec. point
input(range_nF) ; nF is made Hi-z by converting pic pin as input
;range_nF = 0 ; nF,uF deselected,(uF=pnp=off)
range_uF = 1 ; pF is hardwired high
resettrig
while (b'00010000' and PortA) ;RA4 is read,(555 output)
inc(z) ;if high,increment talx
if z ›= 9999 then ;if ›9999pF,shift to nF
begin
nF
end
loop
;the open
zz = z ;leads caps need to be stored twice is stored in z
; (compiler peculiarities?)
procedure(pF) ; incr. talx, when 555 is high
z = zz ; Restoring open leads cap after having been in nF proc
p = 'p'
clr(y) ; no dec. point
input(range_nF)
;range_nF = 0 ; nF,uF deselected,(uF=pnp=off)
range_uF = 1 ; pF is hardwired high
resettrig
while (b'00010000' and PortA) ;RA4 is read,(555 output)
inc(talx) ;if high,increment talx
if talx ›= 9999 then ;if ›9999pF,shift to nF
begin
nF
end
loop
talx = talx-z ;and subtracted from result
while talx › 9999 ;ensures that talx-z doesn't
talx = talx + 1 ;go below zero
loop
if talx ›= 1000 then ;remove a decade and insert
begin ;a dec.point
talx = talx/10
p = 'n' ; n for (n)F
y = 1 ; insert dec.point
end ; 9999pF becomes 9,99nF
if (b'00000001' and PortB) then
begin
q = 1
end
else ;RB0 testing batt.
begin
q = 0
end
if q = 0 then
begin
lo_mess
end
procedure(nF) ; procedure nF same as pF procedure
p = 'n' ; except (n)F
clr(y)
clr(z)
proc = 1
output(range_nF)
range_nF = 1 ; nF range resistor selected
range_uF = 1 ; uF=pnp=off
resettrig
while (b'00010000' and PortA)
inc(talx)
if talx ›= 9999 then
begin
uF
end
loop
if talx ›= 1000 then
begin
talx = talx/10
p = 'u'
y = 1
end
procedure(uF)
proc = 1
p = 'u'
clr(y)
clr(z)
input(range_nF)
;range_nF = 0
range_uF = 0 ;uF(pnp=0=on)
clr(talx)
rst ; 555 reset procedure
trig = 1
Wait(1500)
trig = 0
delay
trig = 1
while (b'00010000' and PortA)
clr(tempcount)
while tempcount ‹= 92 ; div. by 78, caused by the long
inc(tempcount) ; timing pulse in uF range
loop ; calibrated for proper reading
inc(talx)
if talx ›= 9999 then
begin
mF ; goto mF routine if talx exceeds
end ; 9999
loop
if talx ›= 1000 then ; same as in pF,nF
begin
talx = talx/10
p = 'm'
y = 1
end
procedure(mF)
inc(rdy)
proc = 1
p = 'm'
clr(y)
clr(z)
;range_nF = 0
;range_uF = 0 ;uF range (pnp=0=on)
clr(talx)
rst ; 555 reset procedure
waitmessage
trig = 1
Wait(60000) ; due to the long timingpulse
trig = 0 ; an extra long wait must be
delay
trig = 1 ; inserted
while (b'00010000' and PortA) ;if high, increment talx
wait(194) ;incr. has to be slowed down in mF
inc(talx)
loop
if talx ›= 1000 then ; same as in pF,nF
begin
talx = talx/10
p = ' '
y = 1
end
while rdy = 4
ReadyMessage
loop
procedure(resettrig)
clr(talx)
rst ; 555 reset procedure
trig = 1
Wait(100)
trig = 0
delay
trig = 1
procedure(rst)
reset = 1
reset = 0
wait(1)
reset = 1
procedure(delay)
clr(delaycount)
while delaycount ‹= 1 ; Delay for trig pulse
inc(delaycount) ;
loop
Procedure(ReadyMessage)
lcdData = false ; sending command
charout = b'11000000' ; cursor to 2nd line position 1
LCDout
lcdData = true
charout = ' '
LCDout
charout = ' ' ;move display 5 spaces
LCDout ;to the left
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
charout = 'R'
LCDout
charout = 'e'
LCDout
charout = 'a'
LCDout
charout = 'd'
LCDout
charout = 'y'
LCDout
Procedure(WaitMessage)
lcdData = false ; sending command
charout = b'11000000' ; cursor to 2nd line position 1
LCDout
lcdData = true
charout = ' ' ;move display 5 spaces
LCDout ;to the left
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
charout = 'W'
LCDout
charout = 'a'
LCDout
charout = 'i'
LCDout
charout = 't'
LCDout
Procedure(lo_mess)
lcdData = false ; sending command
charout = b'11000000' ; cursor to 2nd line position 1
LCDout
lcdData = true
charout = ' ' ;move display 2 spaces
LCDout ;to the left
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
charout = 'B'
LCDout
charout = 'A'
LCDout
charout = 'T'
LCDout
procedure(doMessage)
lcdData = false ; setup lcd for command receive
charout = b'10000000' ; cursor to 'home' line 1 pos 1
LCDout ; send to lcd
charout = b'00000001' ; clear display
LCDout
lcdData = true ; lcd,receive data
clr(a) ; reset var
clr(nb)
clr(c)
clr(d)
charout = ' ' ;move display 4 spaces
LCDout ;to the left
charout = ' '
LCDout
charout = ' '
LCDout
charout = ' '
LCDout
;********** converts talx to decimals ****************
; by counting, how many 1000's,100's,10's and 1's
;************************************************* ****
while talx ›= 1000 ;How many 1000's
inc(a) ;is put in a
talx = talx - 1000
loop
if a = 0 then ;if no 1000's
begin
charout = ' ' ;write a 'space'
end
else
begin
charout = a + 48 ;convert to ascii
end
LCDout ; send to lcd
while talx ›= 100 ; how many 100's
inc(nb) ; is put in b
talx = talx - 100
loop
if (nb=0) and (a=0) then ;if no 100's
begin
charout = ' ' ; write a 'space'
end
else
begin
charout = nb + 48 ; convert to ascii
end
LCDout
if y = 1 then ;insert dec.point
begin
charout = '.' ;if y = 1
LCDout
end
while talx ›= 10 ;how many 10's
inc(c) ;is put in c
talx = talx - 10
loop
if (c=0) and (nb=0) and (a=0) then ;if no 10's
begin
charout = ' ' ;write a space
end
else
begin
charout = c + 48 ;convert to ascii
end
LCDout ;send to lcd
d = talx ;d=how many 1's
charout = d + 48 ;convert d to ascii
LCDout ;send to lcd
charout = ' ' ;space
LCDout
charout = p ;prefix var ( p n u m )
LCDout
charout = 'F' ;F for farad
LCDout
procedure(InitPort)
output(lcd_rs) ; lcd register select output
output(lcd_en) ; lcd enable output
output(lcd_rw) ; lcd read/write output
output(lcdportD4) ; make port RB4 output
output(lcdportD5) ; make port RB5 output
output(lcdportD6) ; make port RB6 output
output(lcdportD7) ; make port RB7 output
output(range_uF) ; make port output
output(range_nF)
output(reset)
output(trig) ;make RA3 output
input(out_555) ;make RA4 input
input(bat) ;make RB0 input
procedure(InitLCD)
wait(15) ; Жndring fra fшr.
charout = b'00110000' ; 8 bit mode
InitLCDout ; initialise LCD
charout = b'00110000'
InitLCDout
charout = b'00110000'
InitLCDout
charout = b'00100000' ; Жndring fra fшr.
InitLCDout
lcdData = false ; sending command
charout = b'00101000' ; 4 bit, 2 lines, 5x7 font
LCDout ; 4 bit data transfer
charout = b'00011000' ; cursor move, right shift
LCDout
charout = b'00001100' ; display on, cursor+blink off
LCDout
charout = b'00000100' ; entry mode
LCDout
charout = b'00000001' ; clear display
LCDout
procedure(LCDout)
busywait ; is lcd busy
if lcdData = false then
begin
lcd_rs = 0 ; 0 - instruction register
lcd_rw = 0 ; 0 - writing to lcd
end
else
begin
lcd_rs = 1 ; 1 - data register
lcd_rw = 0 ; 0 - writing to lcd
end
send4bits ; call routine to output 4 bits
swap(charout) ; swap lower 4 bits
send4bits ; call routine to output 4 bits
procedure(send4bits)
lcdportD4 = charout AND b'00010000' ; send 4 bits
lcdportD5 = charout AND b'00100000' ; send 4 bits
lcdportD6 = charout AND b'01000000' ; send 4 bits
lcdportD7 = charout AND b'10000000' ; send 4 bits
lcd_en = 1 ; Lcd enable high to low
lcd_en = 0 ; data valid
procedure(busywait)
lcd_rw = 1 ; 1 - reading from lcd
lcd_rs = 0 ; 0 - instruction register
input(lcdportD4) ; make port input
input(lcdportD5) ; make port input
input(lcdportD6) ; make port input
input(lcdportD7) ; make port input
LCDwait
output(lcdportD4) ; make port output
output(lcdportD5) ; make port output
output(lcdportD6) ; make port output
output(lcdportD7) ; make port output
procedure(LCDwait)
lcdbusy = true
while lcdbusy = true ; true = lcd busy, false = ready
lcd_en = 1 ; read data
lcdbusy = lcdportD7 ; receive upper 4 bits first
lcd_en = 0
lcd_en = 1 ; not interested in lower 4
lcd_en = 0 ; bits of status byte
loop
procedure(InitLCDout)
wait(10) ; wait 4 msec (no busy flag)
lcd_rw = 0 ; 0 - writing to lcd
lcd_rs = 0 ; 0 - instruction register
send4bits ; call output 4 bits
|
|
|
|
07.10.2006, 20:50
|
|
Почётный гражданин KAZUS.RU
Регистрация: 13.05.2006
Адрес: Москва
Сообщений: 3,559
Сказал спасибо: 76
Сказали Спасибо 326 раз(а) в 230 сообщении(ях)
|
Бэйсик похоже.
__________________
Обучалка AVR PIC ARM начинающим программирование курс самоучитель шаг за шагом с нуля, CVAVR, PROTEUS, MPLAB, WinAVR, IAR, KEIL электроника - http://proavr.narod.ru
|
|
|
|
07.10.2006, 21:14
|
|
Частый гость
Регистрация: 20.04.2005
Сообщений: 30
Сказал спасибо: 36
Сказали Спасибо 3 раз(а) в 2 сообщении(ях)
|
Сообщение от avr123-nm-ru
|
Бэйсик похоже.
|
Мне нужено конкретное название копилятора, адрес в инете и т.д.......
|
|
|
|
07.10.2006, 22:22
|
|
Почётный гражданин KAZUS.RU
Регистрация: 13.05.2006
Адрес: Москва
Сообщений: 3,559
Сказал спасибо: 76
Сказали Спасибо 326 раз(а) в 230 сообщении(ях)
|
picbasic шукчите в google.com
================
или Mikro бэйсик для ПИК
или "Онхонсофт"
их можно найти в низу стр: avr123.nm.ru
__________________
Обучалка AVR PIC ARM начинающим программирование курс самоучитель шаг за шагом с нуля, CVAVR, PROTEUS, MPLAB, WinAVR, IAR, KEIL электроника - http://proavr.narod.ru
|
|
|
|
07.10.2006, 22:49
|
|
Прописка
Регистрация: 14.08.2006
Сообщений: 106
Сказал спасибо: 19
Сказали Спасибо 7 раз(а) в 7 сообщении(ях)
|
Сообщение от Koka
|
Мне нужено конкретное название копилятора, адрес в инете и т.д.......
|
Если только это, можно спросить на сайте журнала где был напечатан проект. Если есть желание корректировать софт , то можно дизасемблировать HEX.
|
|
|
|
07.10.2006, 23:19
|
|
Гражданин KAZUS.RU
Регистрация: 21.02.2005
Сообщений: 685
Сказал спасибо: 14
Сказали Спасибо 84 раз(а) в 44 сообщении(ях)
|
я понял! Это язык древних инков.
Ясно что Бейсик вот только под него компиляторов понаделоно. Не факт что на любом пойдет, особенно проблемки с дерективами. Но в принцыпе качай любой и подредактируй. Сам компилятор есть на этом сайте.
|
|
|
|
07.10.2006, 23:38
|
|
Частый гость
Регистрация: 20.04.2005
Сообщений: 30
Сказал спасибо: 36
Сказали Спасибо 3 раз(а) в 2 сообщении(ях)
|
Расширение файла psf, может поможет.
|
|
|
|
08.10.2006, 00:05
|
|
Гражданин KAZUS.RU
Регистрация: 21.02.2005
Сообщений: 685
Сказал спасибо: 14
Сказали Спасибо 84 раз(а) в 44 сообщении(ях)
|
У бейсика восновном bas. Может psf паскаль?
|
|
|
|
08.10.2006, 01:21
|
|
Гражданин KAZUS.RU
Регистрация: 17.09.2006
Сообщений: 633
Сказал спасибо: 78
Сказали Спасибо 69 раз(а) в 57 сообщении(ях)
|
psf это pascal source file , это исходник на паскале или по другому Delphi
|
|
|
|
08.10.2006, 01:52
|
|
Гуру портала
Регистрация: 20.11.2004
Сообщений: 10,015
Сказал спасибо: 936
Сказали Спасибо 2,269 раз(а) в 1,563 сообщении(ях)
|
Конечно паскаль.
А паскаль я встречал только один от микроелектроники.
http://www.mikroe.com/en/download/
|
|
|
|
Ваши права в разделе
|
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения
HTML код Выкл.
|
|
|
Часовой пояс GMT +4, время: 23:44.
|
|