Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 12th May 2008, 05:55 PM   (permalink)
Experienced Member
joshua17ss2 is on a distinguished road
Default potential problems

i am working on a simple program to just test displaying data on the lcd, while processing the input from buttons, I finshed code i think will work, i just wana see if any one see some potential hangups, the code is written in basic

thanks for the help
Attached Files
File Type: txt lcd1.txt (1.8 KB, 10 views)
joshua17ss2 is offline   Reply With Quote
Old 13th May 2008, 01:48 PM   (permalink)
Experienced Member
 
AtomSoft is just really niceAtomSoft is just really niceAtomSoft is just really niceAtomSoft is just really nice
Send a message via MSN to AtomSoft Send a message via Skype™ to AtomSoft
Default

this looks like swordfish and if so i dont think you need to have the word SUB in there:
Code:
While True
    If Switch = 1 Then Sub LED1
    EndIf
    If Switch2 = 1 Then Sub LED2 
    EndIf         
Wend
Also it would be wise to rename the subs since you use LED as a sub and variable you might have issues...

Code:
Device = 18F2550
Clock = 20

// some LCD options...
#option LCD_DATA = PORTB.4          // Assign the LCD connections
#option LCD_EN = PORTB.3            //
#option LCD_RS = PORTB.2            //

// import LCD library...
Include "LCD.bas" 
Include "utils.bas"
Include "convert.bas"

Dim Var1 As Word
Dim LED As PORTA.0                  // Assign an alias for "LED"
Dim LED2 As PORTA.1               // Assign an alias for "LED2"
Dim Switch As PORTA.2,              // Assign an alias for "Switch"
Dim Switch2 As PORTA.3,              // Assign an alias for "Switch2"

//subs
Sub Debounce()

    DelayMS(10)                     // Small delay to stop "bouncing"
    
    While Switch = 1                // Wait for the switch to be de-pressed    
    Wend                            //
    
End Sub

Sub LEDA()
    LED = 1
    DelayMS 100
    LED = 0
    DelayMS 100
End Sub

Sub LEDB()
    LED2 = 1
    DelayMS 100
    LED2 = 0
    DelayMS 100
End Sub


// Start Of Program...

SetAllDigital                       // Make all pins digital I/O's

Input(Switch)                       // Make the switch pin an input
Low(LED)                         // Make the LED an output and set it Low
Input(Switch2)                       // Make the switch1 pin an input
Low(LED2)                         // Make the LED2 an output and set it Low



DelayMS(150)                        // Let the LCD warm up
Cls                                 // Clear the LCD screen

WriteAt(1,1,"test")          // Send some text to the LCD
DelayMS(1000)
WriteAt(2,1,"test")
DelayMS(1000)
WriteAt(3,1,"Input function test")
DelayMS(1000)
WriteAt(4,1."2 input, 2 output")

While True
    If Switch = 1 Then LEDA
    EndIf
    If Switch2 = 1 Then LEDB
    EndIf         
Wend
AtomSoft is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Whitfield Pellet Stove Problems Sheriffjer General Electronics Chat 6 1st November 2007 01:36 PM
USB to Serial problems spondootre Micro Controllers 12 28th November 2006 08:09 AM
Surge problems leonel Electronic Projects Design/Ideas/Reviews 3 15th September 2006 02:36 PM
3.2V to 5V TTL interface problems GraveYard_Killer Micro Controllers 9 12th March 2005 01:29 PM
Potential divider... Appleon Electronic Projects Design/Ideas/Reviews 10 24th May 2004 09:45 PM



All times are GMT. The time now is 05:56 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.