Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 05, 2016, 03:40:32 15:40


Login with username, password and session length


Pages: [1]
Print
Author Topic: Proton: LookdownL + Array  (Read 3368 times)
0 Members and 1 Guest are viewing this topic.
Basicpic
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 9
-Receive: 43

Welcome! www.picbasic.ru


WWW
« on: February 16, 2011, 01:06:17 01:06 »

I have a one question.
I have a code:
Code:
DIM ADC AS WORD
DIM G AS BYTE
DIM config[16] AS WORD
Displaying:
G = LOOKDOWNL ADC, <= [ 0, config[1],config[2],config[3],config[4],config[5],config[6],config[7],config[8],config[9],config[10],config[11],config[12],config[13],config[14],config[15],config[16] ]
GOTO Displaying

Why the compiler (3.5.0.6/3.5.1.2) return error - ERROR[Line 210]: Comma missing, or command terminated incorrectly!

With PBP i use this:

Code:
ADC var WORD
 G var BYTE
config[16] var WORD
Displaying:
G = LOOKDOWN2 ADC, <= [ 0, config[1],config[2],config[3],config[4],config[5],config[6],config[7],config[8],config[9],config[10],config[11],config[12],config[13],config[14],config[15],config[16] ]
GOTO Displaying

and not any errors. Why? Proton help have no any info about arrays with LookdownL. Help me, please
Logged

pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #1 on: February 16, 2011, 10:52:35 22:52 »

maybe your syntex is wrong Config is a protected word in Proton, It in the Manual.

Also why are people saying Help don't work. I have seen this asked in Crownhill forum too.
« Last Edit: February 16, 2011, 11:00:44 23:00 by pickit2 » Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
Basicpic
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 9
-Receive: 43

Welcome! www.picbasic.ru


WWW
« Reply #2 on: February 17, 2011, 05:10:51 05:10 »

I know about F1. But my compiler help (.pdf) have no any information about lookdownl + arrays with constant index.

Quote

Syntax
Variable = LookDownL Index, {Operator} [ Value {, Value…etc } ]
Overview
A comparison is made between index and value; if the result is true, 0 is written into variable. If
that comparison was false, another comparison is made between value and value1; if the result
is true, 1 is written into variable. This process continues until a true is yielded, at which time the
index is written into variable, or until all entries are exhausted, in which case variable is unaffected.
Operators
Variable is a user define variable that holds the result of the search.
Index is the variable/constant being sought.
Value(s) can be a mixture of 16-bit constants, string constants and variables. Expressions may
not be used in the Value list, although they may be used as the index value. A maximum of 85
values may be placed between the square brackets, 256 if using an 18F device.
Operator is an optional comparison operator and may be one of the following: -
= equal
<> not equal
> greater than
< less than
>= greater than or equal to
<= less than or equal to

Logged

Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 604

Thank You
-Given: 111
-Receive: 1059



« Reply #3 on: February 18, 2011, 08:45:57 20:45 »

Why you didn't just use this syntax :

G = config[ADC]

it is simple and equivalent to your code

you error is because the symbol  "<="
Logged
fernandodiaz
Junior Member
**
Offline Offline

Posts: 73

Thank You
-Given: 1
-Receive: 18


« Reply #4 on: March 02, 2011, 04:42:22 04:42 »


Hi  i have problems whith proton plus in this code:

Device 12F510
Dim x As Byte   
x = adin 0    "error no support 12 bit"  but this contain some a/d internals

too problems lookup command   , other alternative CDATA dont support
up 100 > ...   [1,2,3,4,5...... ,_
                     150,151...]
with much values dont work fine in this prosessor

some idea?
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #5 on: March 02, 2011, 12:56:20 12:56 »

maybe 12F510 has A/D internals, But proton don't support that device.
see page 44 of manual.
« Last Edit: March 02, 2011, 12:59:00 12:59 by pickit2 » Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
FranzW
Active Member
***
Offline Offline

Posts: 161

Thank You
-Given: 452
-Receive: 71



« Reply #6 on: January 31, 2012, 05:16:17 17:16 »

Hello,
Perhaps I should have started a new thread, but I don't know how to do it.

I need to count fast incoming encoder pulses by means of interrupts on PORTB.7. Does somebody know what must I do in order to place my interrupt routine at ORG 4, the interrupt vector address? If I use ORG 04 in the program below, Proton issues the error message: “Overwriting previous address contents (0004)”
Part of the program can be seen below.

Device = 16F877A
Declare Xtal = 4
All_Digital = true
Dim Pulses As Word 'To store RB7 interrupts
TRISB = %11111001

' OTHER VARIABLES, TRIS, etc. WILL BE DECLARED HERE.

'Making place to save the required registers during the interrupt.
'Since I didn’t find anything about this in the Proton manual,
'I created room to save the registers, as stated in the PBP V 2.46 manual.
Asm
     W0 equ 0x0020 'bank 0 place For W
     S0 equ 0x0021 'bank 0 place for STATUS
     P0 equ 0x0022 'bank 0 place for PCLATH
     W1 equ 0x00A0 'bank 1 place for W
     W2 equ 0x0120 'bank 2 place For W
     W3 equ 0x01A0 'bank 3 place For W       
EndAsm   
         

GoTo Program 'Jump over the interrupt routine
'***********************************************
'*************Interrupt routine

Asm
   'Save registers
   Movwf W0
   Swapf STATUS, w
   Clrf STATUS
   Movwf S0
   Movf PCLATH, w
   Movwf P0
   
   'The interrupt code will be placed here.
   
   
   'Restore registers
   Movf P0, w
   Movwf PCLATH
   Swapf S0, w
   Movwf STATUS
   Swapf W0, f
   Swapf W0, w
   Retfie
EndAsm
'*****************************************
Program:
'Program code is placed here.

Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #7 on: January 31, 2012, 11:40:30 23:40 »

To start a new topic select "New Topic" in section you want to post in.
you will see new topic button to the right

Sonsivri > Electronics > Pic Basic Languages This Topic
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC