Advertisement  

Saturday, 08 February 2025
     
 
Main Menu
Home Home
Shop Shop
News News
BASCOM-AVR BASCOM-AVR
BASCOM-8051 BASCOM-8051
Products Products
Application Notes Application Notes
Publications Publications
Links Links
Support Center Support Center
Downloads Downloads
Forum Forum
Resellers Resellers
Contact Us Contact Us
Updates Updates
MCS Wiki MCS Wiki
Online Help
BASCOM-AVR Help BASCOM-AVR Help
BASCOM-8051 Help BASCOM-8051 Help
Contents in Cart
Show Cart
Your Cart is currently empty.
Search the Shop

Products Search

User Login
Username

Password

If you have problem after log in with disappeared login data, please press F5 in your browser

RSS News
 
     
 

 
   
     
 
AN #101 - BASCOM-AVR example that demonstrates SNAP protocol Print
The program shows how to implement the S.N.A.P protocol in BASCOM

This first AVR application note is donated by Mike Eitel.
The program shows how to implement the S.N.A.P protocol in BASCOM
and is a simple example to turn a LED ON or OFF. It uses PLM-24  Power Line Modems to communicate over the power lines (mains).

This example uses 16-bit CRC-CCITT as error detection method which gives secure data transfer.

This small program gives you some starter for AVR 8515 with S.N.A.P protocol.

It is tested with original STK200 kit.
I use 8 additional LED on Port C and 1 LED from MISC pin OC1B to see results.  (LED + 1k to VCC)

You can see:
Port A : Not used
Port B : The value of the so called commands
Port C : The value of the send data
Port D : Not used
Pin OC1B : The frequency of the Timer1 ( slower if interrupt enabled)

I used the SNAP16 and the DEMO2 program from HTH as base of my modifications.

AVR is node 4, the PC (NT4 SP5) is node 1.
Preambles are "M" for the master and "S" for the slave.

All telegrams use 1 Byte data.


To AVR you send via SEND or +1 button. See result at Port C.

For data request I implemented command codes,
means you can give a command ( 0 to 255 ) in the field and press the READ button.
Then the AVR send his data to the master.

There are momentary 3 commands implemented:

128 requests the momentary value of timer1's low byte.
129 starts interrupt timer1 ( decrementing value of db1 and sends value to master )
130 stops interrupt timer1


The VB program is written with VB5 called SNAP.BAS
The AVR is written with BASCOM AVR called _Mike_SNAP.

Download source code in .ZIP file

Note that SNAP is copyright material of High Tech Horizon