PDA

View Full Version : bh 1415f and picbasic problem



patricx
- 18th September 2007, 21:34
i have make a program in picbasic but it do not write to the bh1415 this is my program can some one fixed it

'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : Patrick Klok *
'* Notice : Copyright (c) 2007 *
'* : All Rights Reserved *
'* Date : 30-8-2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
DEVICE 16F628A ;Gebruik een 16F628A type
CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_OFF




ALL_DIGITAL = 1
LCD_TYPE = 0
LCD_INTERFACE = 4
LCD_LINES = 2
LCD_DTPIN = PORTB.0
LCD_ENPIN = PORTA.3
LCD_RSPIN = PORTA.2


DIM Teller AS DWORD ;Deze variabele bevat de Teller
DIM Freq AS DWORD ;Deze variabele bevat de Freq
DIM BH1415 AS DWORD ;Deze variabele bevat de BH1415
dim ACTIE AS BYTE
Symbol AAN = 0
Symbol UIT = 1


Symbol S1 = PORTA.6
Symbol S2 = PORTA.7
Symbol S3 = PORTA.0
Symbol S4 = PORTA.1
symbol DTA = portb.5
symbol CLK = portb.6
symbol ENB = portb.7


CLEAR ;Wis alle RAM geheugen
DELAYMS 500 ;LCD stabilisering
cls
PRINT AT 1, 1, "TEST VERSION 0.9" ;
PRINT AT 2, 1, "PLL TRANSMITTER" ;
DELAYMS 2000
CLS ;Scherm wissen
Teller = Eread 0 ;Haal laatst ingestelde freq op
IF Teller < 875 then Teller = 875 ; als teller kleiner is dan 87.5 mhz teller = 87.5 mhz
IF Teller > 1080 then Teller = 1080 ;

ACTIE=1

;Hoofdprogramma
WHILE 1 = 1



If S1 = AAN and Teller < 1080 THEN
Teller = Teller +1 ; Freq verhogen
DELAYMS 25 ;Anti contactdender
WHILE S1 = AAN : WEND ;Wacht tot S1 wordt losgelaten
ACTIE = 1
ENDIF



If S2 = AAN and Teller > 875 Then
Teller = Teller - 1 ; Freg verlagen
DELAYMS 25 ;Anti contactdender
WHILE S2 = AAN : WEND ;Wacht tot S2 wordt losgelaten
ACTIE = 1
ENDIF

if ACTIE = 1 then
BH1415 = Teller
BH1415.11 = 1
BH1415.12 = 1
BH1415.13 = 0
BH1415.14 = 1
BH1415.15 = 0
ENB = 1
DELAYMS 5
SHOUT DTA , CLK , lsbFIRST , [ BH1415 \ 16 ]
DELAYMS 5
ENB = 0

ACTIE = 0
endif






Freq = Teller

PRINT AT 1, 1, DEC Freq/10, ".",DEC1 Freq, " MHZ", " STEREO";Met 1 cijfer na de komma

PRINT AT 2, 1,"PLL TRANSMITTER" ;


EWRITE 0, [Teller] ; schrijf de ingestelde freq naar eeprom





WEND
END ;Einde programma

GrandPa
- 18th September 2007, 21:56
Well, this is looking like a basic program, NOT picbasic

There are many invalid picbasic commands/statements in your program. I think you should read the picbasic manual first before trying to do any programming.

DIM, PRINT, DELAYMS, SHOUT, EWRITE, CLS are NOT valid commands
IF/THEN are not used properly (missing ENDIF)
Variable are not declared the correct way

And there is probably many more errors...

J-P

patricx
- 18th September 2007, 22:09
it is in proton picbasic

Darrel Taylor
- 18th September 2007, 22:19
The Proton forum is at

http://www.picbasic.org/forum/

This forum is for PicBasic Pro.

.