| Author |
Message |
Otto
Guest
|
Posted:
Wed Jan 05, 2005 4:41 pm Post subject:
Picoweb Project |
|
|
Are somebody using Picoweb to create small application.
I'm not a assembler guru but have some question ?
Regards
Otto |
|
| Back to top |
|
 |
martin griffith
Guest
|
Posted:
Wed Jan 05, 2005 6:06 pm Post subject:
Re: Picoweb Project |
|
|
On Wed, 05 Jan 2005 12:41:53 +0100, in comp.arch.embedded Otto
<ohaldi@freesurf.ch> wrote:
| Quote: | Are somebody using Picoweb to create small application.
I'm not a assembler guru but have some question ?
Regards
Otto
do you mean from |
www.picoweb.net ?
I was just browsing that site and noticed that it has not been updated
since 2000
e.g. http://www.picoweb.net/downloads.html
"Last modified: November 10, 2000"
martin
Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank. |
|
| Back to top |
|
 |
Richard H.
Guest
|
Posted:
Wed Jan 05, 2005 7:30 pm Post subject:
Re: Picoweb Project |
|
|
Otto wrote:
| Quote: | Are somebody using Picoweb to create small
application.
I'm not a assembler guru but have some question ?
|
Go ahead. Many folks here have experience with the AVR. I've built the
breadboard version of PicoWeb, but I've not used his source code.
Also, if your questions are very PicoWeb-specific, you could also ask
Bruce Lightner directly. I found him very willing to answer questions.
Richard |
|
| Back to top |
|
 |
Otto
Guest
|
Posted:
Thu Jan 06, 2005 12:56 am Post subject:
Re: Picoweb Project |
|
|
In article <41DBFA0D.FED2DDE2@no.spam>, Richard H. wrote:
| Quote: | Go ahead. Many folks here have experience with the AVR. I've built the
breadboard version of PicoWeb, but I've not used his source code.
I have a source and can't do what I wont. I like to modify it, but have |
some problem. And I won't disturb this forum with my source!
| Quote: | Also, if your questions are very PicoWeb-specific, you could also ask
Bruce Lightner directly. I found him very willing to answer questions.
I send 2 or three e-mails to lightner but never get any answer! |
Otto |
|
| Back to top |
|
 |
Otto
Guest
|
Posted:
Thu Jan 06, 2005 12:56 am Post subject:
Re: Picoweb Project |
|
|
In article <fepnt0dgvvcs2vq8f80n6d9bhmvgp2ftvg@4ax.com>, Martin griffith
wrote:
| Quote: | I was just browsing that site and noticed that it has not been updated
since 2000
e.g. http://www.picoweb.net/downloads.html
"Last modified: November 10, 2000"
Yes I know. Thanks |
Otto |
|
| Back to top |
|
 |
Richard H.
Guest
|
Posted:
Thu Jan 06, 2005 5:02 am Post subject:
Re: Picoweb Project |
|
|
Otto wrote:
| Quote: | I have a source and can't do what I wont. I like to
modify it, but have some problem. And I won't
disturb this forum with my source!
|
Folks regularly post sections of code here for discussion, as long as
it's your code (not licensed source). What is it you are trying to
change, and what's not working?
Another place to ask is at http://www.avrfreaks.net - there's likely to
be someone there with PicoWeb code experience. |
|
| Back to top |
|
 |
Otto
Guest
|
Posted:
Thu Jan 06, 2005 4:56 pm Post subject:
Re: Picoweb Project |
|
|
In article <41DC8025.69E876C0@no.spam>, Richard H. wrote:
| Quote: | Folks regularly post sections of code here for discussion, as long as
it's your code (not licensed source). What is it you are trying to
change, and what's not working?
I used a sample source form Picoweb and changed small things. |
With this source I can switch ON/OFF 4 relais through a HTML page
(relais.htm).
I like now to use a button (switch 2) to clear locally (switch OFF all
4 relays). For this I like to use the Port 2.
All comment are in French but if it's necessary I can translate it.
Many thanks in advance for your help.
Regards
Otto
#Define BANNER "\r\nPicoWeb\r\n"
//#define USE_BOOTP
#define NET_CONFIG_IP /* permet la reconfiguration de l'IP
via net */
#define EEPROM_IP /* utilise le fichier "ip" pour
l'adresse IP */
#define ENABLE_WATCHDOG /* utilise le watchdog de l'Atmel */
#define DEBUGGER /* ajoute le debugger firmware */
#define CLOCK 8000000 /* fréquence de l'horloge (Hz) */
#define BAUD_RATE 19200 /* fréquence du port série en baud */
#define OFFSET buf
#define VAL buf+2
#define REL_PORT PORTD
#define SWITCH 2 /* Port pour le switch */
#define REL_BIT1 3
#define REL_BIT2 4
#define REL_BIT3 5
#define REL_BIT4 6
//
// Fichier spécifique à la page HTML
//
relais.htm // Page web par default
//
// Inclusion du code spécifique (pcode) et/ou language AVR qui suit
//
#avr_reset
;----------------------------------------------------------------------
; ce code est exécuté chaque fois que le microcontroller subit un reset
;----------------------------------------------------------------------
;
data
global hit_count
hit_count: .skip 2 ; Comteur de hits sur 16-bits
text
cbi ddrd,SWITCH ; pin en entrée 'Switch'
sbi ddrd,REL_BIT1 ; pin en sortie pour la commande des
relais
sbi ddrd,REL_BIT2
sbi ddrd,REL_BIT3
sbi ddrd,REL_BIT4
cbi REL_PORT,SWITCH
sbi REL_PORT,REL_BIT1
sbi REL_PORT,REL_BIT2
sbi REL_PORT,REL_BIT3
sbi REL_PORT,REL_BIT4
clr r17 ; Efface le compteur de hit
sts hit_count,r17
sts hit_count+1,r17
#avr_slow
;----------------------------------------------------------------------
; ce code est exécuté chaque seconde "slow idle"
;----------------------------------------------------------------------
;
; AteHo, 05.01
in r1,portd ; lecture du portd dans r0
#avr_fast
;----------------------------------------------------------------------
; ce code est excécuté selon la disponibilité ou vitesse du cpu "fast
idle"
;----------------------------------------------------------------------
;
#avr_asm
;----------------------------------------------------------------------
; application spécifique CGI (pcode) et assembleur (AVR)
;----------------------------------------------------------------------
;
; Compteur de hits, affichage en text
;
pshow_hits:
pincw hit_count ; incrémente le compteur
pprintswi [hit_count] ; sortie en ascii décimale
pret ; retour
; AteHo, 05.01
pshow_switch:
pprintswi [r0]
pret
;
; Check port D, contrôle URL pour "?X=Y?" et met à jour le bit
; "X" est le bit du port D et Y la valeur (0 ou 1)
;
section seeprom
.global check_portd
check_portd:
ppushn OFFSET,4 ; sauve 4 bytes sur le stack
purl2s OFFSET,[url_parms],2 ; déplace le buffer URL en mémoire
pjumpne pas_de_param_url ; si rien dans OFFSET alors on quitte
pcmpbi OFFSET+1,'=' ; compare byte "n="?
pjumpne pas_de_param_url ; si erreur dans la comparaison alors
on quitte
pcmpbi OFFSET,'0' ; compare si valeur de 0 à 9 (pas de
caractère)
pjumplo pas_de_param_url ; si plus petit que '0' alors on
quitte
pcmpbi OFFSET,'9'+1 ; compare la valeur max '9'
pjumphis pas_de_param_url ; si plus grand que '9' alors on
quitte
paddwi url_parms,2
purl2s VAL,[url_parms],1
pjumpne pas_de_param_url
psetportd [byte VAL],[byte OFFSET] ; mise à jour du bit
pas_de_param_url:
ppopn OFFSET,4 ; restore du stack
pret ; retour
.global testport
checkport:
ptestport ; contr les I/O du port (bit)
pret ; retour
cseg
.global psetportdbit
psetportd: pcode_routine 2
mov r20,r10 ; déplace valeur r10 dans r20
mov r21,r12 ; déplace no du bit de r12 dasn r21
rcall exp_r21 ; saut à la sousroutine exp_r22 =
1<<r21
in r0,portd ; lecture du portd dans r0
com r22 ; complément $FF-r22
and r0,r22 ; et logique entre r0 et r22, efface
bit
andi r20,1 ; et logique 0/1 et place le résultat
dans r20
breq psetportdbit_out ; saut si Z flag = 0, routine
psetportdbit_out
com r22 ; back to just the bit
or r0,r22
psetportdbit_out: ; routine psetpordbit_our
out portd,r0 ; sauve r0 dans le pord "D"
ret ; retour
cseg
.global exp_r21
exp_r21: ; sousroutine exp_r21
ldi r22,1 ; charge 1 comme bit masque
andi r21,7 ; and (bit 0..7)
exp_loop:
breq expret ; saut si égal
lsl r22 ; rotation à gauche du registre r22
dec r21 ; décrémente r21
rjmp exp_loop ; saut relatif
expret:
ret ; retour de la sous routine exp_r21 |
|
| Back to top |
|
 |
Richard H.
Guest
|
Posted:
Thu Jan 06, 2005 8:43 pm Post subject:
Re: Picoweb Project |
|
|
Otto wrote:
| Quote: | I like now to use a button (switch 2) to clear
locally (switch OFF all 4 relays). For this I like
to use the Port 2.
|
OK, so the problem is that you are adding an input button and it is not
working properly, right?
I see the button is connected to PortD, pin 2 (the 3rd pin).
1) You need a pull-up resistor on the input signal so it will return to
a known state (+5v) when the button is not pressed, otherwise it will
"float" when not pressed and the value will fluctuate / be undefined.
You can activate the AVR's internal pull-up by writing a 1 (sbi) on its
output pin when in input mode. You need to watch that this doesn't
accidentally get changed if you do byte output to the port.
sbi REL_PORT,SWITCH
Or, you can add a resistor (say, 10k) between +5v and the input. Lower
values will work faster but draw more current from the AVR.
2) FYI, when you eventually have the button do more than just "reset"
the relay state, you will need to read-up on "de-bouncing". The switch
actually make/breaks contact many times when being pressed once - this
works fine for a "reset" action which can execute many times on one
press, but it will cause you headaches in other uses.
3) You don't seem to be checking the input bit for a value anywhere.
This would seem appropriate to do in the AVR_Slow section, though you're
probably more familiar with the stucture for Picoweb's. From how your
code is structured, it seems you could just check the input and clear
the port bits there.
Thoughts? |
|
| Back to top |
|
 |
Otto
Guest
|
Posted:
Thu Jan 06, 2005 10:26 pm Post subject:
Re: Picoweb Project |
|
|
Hello Richard
| Quote: | You can activate the AVR's internal pull-up by writing a 1 (sbi) on its
output pin when in input mode. You need to watch that this doesn't
accidentally get changed if you do byte output to the port.
sbi REL_PORT,SWITCH
Many thanks for all your information. If you give me your e-mail, I can |
send you a link to see how it work!
Regards
Otto |
|
| Back to top |
|
 |
|
|
|
|